iOS Guides | Samples

MonoTouch.Security.SecKeyChain Class

Access to the operating system keychain.

See Also: SecKeyChain

Syntax

public static class SecKeyChain : INativeObject

Remarks

This class can be used to add, remove, update or query the iOS or MacOS keychain. MacOS is limited to a single kind of password (SecKind.InternetPassword) while iOS offers a wider range of options.

Use SecKeyChain.QueryAsData to get values from the keychain as a binary blob. Some of the overloads can also return binary blobs that are suitable to be stored on disk, or passed to another process.

Use SecKeyChain.QueryAsConcreteType to get a SecCertificate, a SecKey or a SecIdentity back from the keychain.

Use SecKeyChain.QueryAsRecord to get a strongly typed SecRecord with the results of your query.

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);

Related content

Requirements

Namespace: MonoTouch.Security
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.Security.SecKeyChain are listed below.

See Also: Object

Public Methods

static
Add(SecRecord) : SecStatusCode
Adds the specified record to the keychain.
static
AddIdentity(SecIdentity)
static
FindIdentity(SecCertificate, Boolean) : SecIdentity
static
QueryAsConcreteType(SecRecord, out SecStatusCode) : Object
Use this method to query the KeyChain and get back a SecCertificate, a SecKey or a SecIdentity.
static
QueryAsData(SecRecord) : NSData
Fetches an NSData record from the Keychain.
static
QueryAsData(SecRecord, Int32) : NSData[]
Fetches a set of NSData records from the Keychain.
static
QueryAsData(SecRecord, Boolean, out SecStatusCode) : NSData
Fetches a set of NSData records from the Keychain.Fetches an NSData record from the Keychain.
static
QueryAsData(SecRecord, Boolean, Int32, out SecStatusCode) : NSData[]
Fetches a set of NSData records from the Keychain.
static
QueryAsRecord(SecRecord, out SecStatusCode) : SecRecord
Fetches a single SecRecord.
static
QueryAsRecord(SecRecord, Int32, out SecStatusCode) : SecRecord[]
Fetches one or more SecRecords.
static
QueryAsReference(SecRecord, Int32, out SecStatusCode) : INativeObject[]
static
Remove(SecRecord) : SecStatusCode
Removes the specified record from the keychain.
static
RemoveIdentity(SecIdentity)
static
Update(SecRecord, SecRecord) : SecStatusCode
Updates the record matching the query with the provided data.