private bool DeletePasswordImpl(string credentialId) { // Find password, then Delete, then cleanup using (KeyChainItemHandle handle = LookupKeyChainItem(credentialId)) { if (handle == null) { return(false); } Interop.Security.OSStatus status = Interop.Security.SecKeychainItemDelete(handle); return(status == Interop.Security.OSStatus.ErrSecSuccess); } }
/// <summary> /// Finds the first password matching this credential /// </summary> private bool FindPassword(string credentialId, out string password) { password = null; using (KeyChainItemHandle handle = LookupKeyChainItem(credentialId)) { if (handle == null) { return(false); } password = handle.Password; } return(true); }