See Also: SecKeyChain Members
This class provides both basic and advanced means to manipulate iOS or MacOS keychain. Majority Mac OS X keychain scenarios involve adding or looking up the stored password. AddInternetPassword and FindInternetPassword provide high-level API to accomplish this for Internet passwords. For generic passwords, the AddGenericPassword and FindInternetPassword perform the same task. Other methods of this class may be used for iOS or more advanced MacOS keychain scenarios.
C# Example
var password = Encoding.UTF8.GetBytes("pA$$w0rd"); SecKeyChain.AddInternetPassword("bugzilla.novell.com", "miguel", password);
C# Example
byte[] password = null; var code = SecKeyChain.FindInternetPassword("bugzilla.novell.com", "miguel", out password); if (code == SecStatusCode.Success) { var passwordString = Encoding.UTF8.GetString(password); Console.WriteLine("The password for the account is: {0}", passwordString); }
C# Example
var query = new SecRecord (SecKind.InternetPassword) { Sever = "bugzilla.novell.com", Account = "miguel" }; var password = SecKeyChain.QueryAsData (query); Console.WriteLine ("The password for the account is: {0}", password);