Edit

Share via


SecRecord Constructors

Definition

Overloads

SecRecord()
SecRecord(SecCertificate)
SecRecord(SecIdentity)
SecRecord(SecKey)
SecRecord(SecKind)

Creates a keychain record.

SecRecord()

public SecRecord ();

Applies to

SecRecord(SecCertificate)

public SecRecord (Security.SecCertificate certificate);
new Security.SecRecord : Security.SecCertificate -> Security.SecRecord

Parameters

certificate
SecCertificate

Applies to

SecRecord(SecIdentity)

public SecRecord (Security.SecIdentity identity);
new Security.SecRecord : Security.SecIdentity -> Security.SecRecord

Parameters

identity
SecIdentity

Applies to

SecRecord(SecKey)

public SecRecord (Security.SecKey key);
new Security.SecRecord : Security.SecKey -> Security.SecRecord

Parameters

key
SecKey

Applies to

SecRecord(SecKind)

Creates a keychain record.

public SecRecord (Security.SecKind secKind);
new Security.SecRecord : Security.SecKind -> Security.SecRecord

Parameters

secKind
SecKind

Determines the class for this record.

Remarks

When you create a SecRecord you need to specify the kind of record that you will be matching using one of the SecKind values, and you must set also:

  • One or more attributes to match (AccessGroup, Accessible, Account, ApplicationLabel, ApplicationTag, AuthenticationType, CanDecrypt, CanDerive, CanEncrypt, CanSign, CanUnwrap, CanVerify, CanWrap, CertificateEncoding, CertificateType, Comment, CreationDate, Creator, CreatorType, Description, EffectiveKeySize, Generic, Invisible, IsNegative, IsPermanent, Issuer, KeyClass, KeySizeInBits, KeyType, Label, ModificationDate, Path, Port, Protocol, PublicKeyHash, SecurityDomain, SerialNumber, Server, Service, Subject, SubjectKeyID):
  • Optional search attributes, used to determine how the search is performed. You do this by setting any of the Match properties in the class (MatchCaseInsensitive, MatchEmailAddressIfPresent, MatchIssuers, MatchItemList, MatchPolicy, MatchSubjectContains, MatchTrustedOnly, MatchValidOnDate) :

Once the class is constructed, you can pass this to the Query, Add, Remove or Update methods on the SecKeyChain class.

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

Internally this is setting the kSecClass key to one of the kSec* values as specifed by the SecKind. On MacOS X the only supported value is InternetPassword, while iOS offers a wider range of options.

Applies to