WSCCertificateItem Class Reference
| Inherits from | WSCKeychainItem : NSObject |
| Declared in | WSCCertificateItem.h WSCCertificateItem.m |
Overview
The WSCCertificateItem class is a subclass of WSCKeychainItem representing an X.509 certificate.
A digital certificate is a collection of data used to verify the identity of the holder or sender of the certificate. For example, a certificate contains such information as:
Certificate issuer
Certificate holder
Validity period (the certificate is not valid before or after this period)
Public key of the owner of the certificate
Certificate extensions, which contain additional information such as allowable uses for the private key associated with the certificate
Digital signature from the certification authority to ensure that the certificate has not been altered and to indicate the identity of the issuer
Each certificate is verified through the use of another certificate, creating a chain of certificates that ends with the root certificate. The issuer of a certificate is called a certification authority (CA). The owner of the root certificate is the root certification authority. See Security Overview for more details about the structure and contents of a certificate.
Every public key is half of a public-private key pair. As implied by the names, the public key can be obtained by anyone, but the private key is kept secret by the owner of the key. Data encrypted with the private key can be decrypted only with the public key, and vice versa. In order to both encrypt and decrypt data, therefore, a given user must have both a public key (normally embedded in a certificate) and a private key. The combination of a certificate and its associated private key is known as an identity. WaxSealCore framework and the underlying Certificate, Key, and Trust Services includes API to find the certificate or key associated with an identity and to find an identity when given search criteria. The search criteria include the permitted uses for the key.
In OS X, keys and certificates are stored on a keychain (represented by the WSCKeychain in WaxSealCore framework), a database that provides secure (that is, encrypted) storage for private keys and other secrets as well as unencrypted storage for other security-related data. The WaxSealCore API that search for keys, certificates, and identities all use the keychain for this purpose. On an OS X system, you can use the Keychain Access utility which has friendly GUI to see the contents of the keychain and to examine the contents of certificates.
The WSCCertificateItem class worked conjunction with other classes in your application to:
- Determine identity by matching a certificate with a private key
- Create and request certificate objects
- Import certificates, keys, and identities
- Create public-private key pairs
- Represent trust policies
Concurrency Considerations
On OS X v10.6, some methods can block while waiting for input from the user (for example, when the user is asked to unlock a keychain or give permission to change trust settings). In general, it is safe to use the methods in this class from threads other than your main thread, but you should avoid calling the method from multiple operations, work queues, or threads concurrently. Instead, function calls should be serialized (or confined to a single thread) to prevent any potential problems. Exceptions are noted in the discussions of the relevant methods.
Tasks
Subject Attributes of a Certificate
-
subjectEmailAddressproperty -
subjectCommonNameproperty -
subjectOrganizationproperty -
subjectOrganizationalUnitproperty -
subjectCountryAbbreviationproperty -
subjectStateOrProvinceproperty -
subjectLocalityproperty
Issuer Attributes of a Certificate
-
issuerEmailAddressproperty -
issuerCommonNameproperty -
issuerOrganizationproperty -
issuerOrganizationalUnitproperty -
issuerCountryAbbreviationproperty -
issuerStateOrProvinceproperty -
issuerLocalityproperty
General Attributes of a Certificate
-
serialNumberproperty -
effectiveDateproperty -
expirationDateproperty
Managing Public Key
-
publicKeyproperty -
publicKeySignatureproperty -
publicKeySignatureAlgorithmproperty
Comparing Certificates
Certificate, Key, and Trust Services Bridge
-
secCertificateItemproperty
Properties
effectiveDate
The effective date of a certificate represented by receiver.
@property (retain, readonly) NSDate *effectiveDateDeclared In
WSCCertificateItem.hexpirationDate
The expiration date of a certificate represented by receiver.
@property (retain, readonly) NSDate *expirationDateDeclared In
WSCCertificateItem.hissuerCommonName
The common name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerCommonNameDeclared In
WSCCertificateItem.hissuerCountryAbbreviation
The country abbreviation of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerCountryAbbreviationDeclared In
WSCCertificateItem.hissuerEmailAddress
The Email address of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerEmailAddressDeclared In
WSCCertificateItem.hissuerLocality
The locality name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerLocalityDeclared In
WSCCertificateItem.hissuerOrganization
The organization name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerOrganizationDeclared In
WSCCertificateItem.hissuerOrganizationalUnit
The organizational unit name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerOrganizationalUnitDeclared In
WSCCertificateItem.hissuerStateOrProvince
The state or province name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerStateOrProvinceDeclared In
WSCCertificateItem.hpublicKey
The public key that was wrapped in the certificate represented by receiver.
@property (retain, readonly) WSCKey *publicKeyDeclared In
WSCCertificateItem.hpublicKeySignature
The signature (calculating by using the signature algorithm represented by publicKeySignatureAlgorithm ) of public key
that was wrapped in the certificate. (read-only)
@property (retain, readonly) NSData *publicKeySignatureDeclared In
WSCCertificateItem.hpublicKeySignatureAlgorithm
The signature algorithm used for signing the public key that was wrapped in a certificate. (read-only)
@property (assign, readonly) WSCSignatureAlgorithmType publicKeySignatureAlgorithmDiscussion
See “WSCSignatureAlgorithmType” for possible values.
Declared In
WSCCertificateItem.hsecCertificateItem
The reference of the SecCertificate opaque object, which wrapped by WSCCertificateItem object. (read-only)
@property (unsafe_unretained, readonly) SecCertificateRef secCertificateItemDiscussion
If you are familiar with the underlying Certificate, Key, and Trust Services API, you can move freely back and forth between WaxSealCore framework and Certificate, Key, and Trust Services API with this property.
Declared In
WSCCertificateItem.hserialNumber
The serial number of a certificate. (read-only)
@property (copy, readonly) NSString *serialNumberDeclared In
WSCCertificateItem.hsubjectCommonName
The common name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectCommonNameDeclared In
WSCCertificateItem.hsubjectCountryAbbreviation
The country abbreviation of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectCountryAbbreviationDeclared In
WSCCertificateItem.hsubjectEmailAddress
The Email address of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectEmailAddressDeclared In
WSCCertificateItem.hsubjectLocality
The locality name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectLocalityDeclared In
WSCCertificateItem.hsubjectOrganization
The organization name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectOrganizationDeclared In
WSCCertificateItem.hInstance Methods
isEqualToCertificate:
Returns a BOOL value that indicates whether a given certificate is equal to receiver.
- (BOOL)isEqualToCertificate:(WSCCertificateItem *)_AnotherCertificateParameters
- _AnotherCertificate
The certificate with which to compare the receiver.
Return Value
YES if _AnotherCertificate is equivalent to receiver; otherwise NO.
One more thing
When you know both objects are keychains, this method is a faster way to check equality than method isEqual:.
Declared In
WSCCertificateItem.h