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
-
subjectEmailAddress
property -
subjectCommonName
property -
subjectOrganization
property -
subjectOrganizationalUnit
property -
subjectCountryAbbreviation
property -
subjectStateOrProvince
property -
subjectLocality
property
Issuer Attributes of a Certificate
-
issuerEmailAddress
property -
issuerCommonName
property -
issuerOrganization
property -
issuerOrganizationalUnit
property -
issuerCountryAbbreviation
property -
issuerStateOrProvince
property -
issuerLocality
property
General Attributes of a Certificate
-
serialNumber
property -
effectiveDate
property -
expirationDate
property
Managing Public Key
-
publicKey
property -
publicKeySignature
property -
publicKeySignatureAlgorithm
property
Comparing Certificates
Certificate, Key, and Trust Services Bridge
-
secCertificateItem
property
Properties
effectiveDate
The effective date of a certificate represented by receiver.
@property (retain, readonly) NSDate *effectiveDate
Declared In
WSCCertificateItem.h
expirationDate
The expiration date of a certificate represented by receiver.
@property (retain, readonly) NSDate *expirationDate
Declared In
WSCCertificateItem.h
issuerCommonName
The common name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerCommonName
Declared In
WSCCertificateItem.h
issuerCountryAbbreviation
The country abbreviation of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerCountryAbbreviation
Declared In
WSCCertificateItem.h
issuerEmailAddress
The Email address of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerEmailAddress
Declared In
WSCCertificateItem.h
issuerLocality
The locality name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerLocality
Declared In
WSCCertificateItem.h
issuerOrganization
The organization name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerOrganization
Declared In
WSCCertificateItem.h
issuerOrganizationalUnit
The organizational unit name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerOrganizationalUnit
Declared In
WSCCertificateItem.h
issuerStateOrProvince
The state or province name of the issuer of a certificate. (read-only)
@property (copy, readonly) NSString *issuerStateOrProvince
Declared In
WSCCertificateItem.h
publicKey
The public key that was wrapped in the certificate represented by receiver.
@property (retain, readonly) WSCKey *publicKey
Declared In
WSCCertificateItem.h
publicKeySignature
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 *publicKeySignature
Declared In
WSCCertificateItem.h
publicKeySignatureAlgorithm
The signature algorithm used for signing the public key that was wrapped in a certificate. (read-only)
@property (assign, readonly) WSCSignatureAlgorithmType publicKeySignatureAlgorithm
Discussion
See “WSCSignatureAlgorithmType” for possible values.
Declared In
WSCCertificateItem.h
secCertificateItem
The reference of the SecCertificate
opaque object, which wrapped by WSCCertificateItem
object. (read-only)
@property (unsafe_unretained, readonly) SecCertificateRef secCertificateItem
Discussion
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.h
serialNumber
The serial number of a certificate. (read-only)
@property (copy, readonly) NSString *serialNumber
Declared In
WSCCertificateItem.h
subjectCommonName
The common name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectCommonName
Declared In
WSCCertificateItem.h
subjectCountryAbbreviation
The country abbreviation of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectCountryAbbreviation
Declared In
WSCCertificateItem.h
subjectEmailAddress
The Email address of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectEmailAddress
Declared In
WSCCertificateItem.h
subjectLocality
The locality name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectLocality
Declared In
WSCCertificateItem.h
subjectOrganization
The organization name of the subject of a certificate. (read-only)
@property (copy, readonly) NSString *subjectOrganization
Declared In
WSCCertificateItem.h
Instance Methods
isEqualToCertificate:
Returns a BOOL
value that indicates whether a given certificate is equal to receiver.
- (BOOL)isEqualToCertificate:(WSCCertificateItem *)_AnotherCertificate
Parameters
- _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