2 * Copyright (c) 2002-2011,2013 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 @header SecCertificate
26 The functions provided in SecCertificate implement and manage a particular type of keychain item that represents a certificate. You can store a certificate in a keychain, but a certificate can also be a transient object.
28 You can use a certificate as a keychain item in most functions.
31 #ifndef _SECURITY_SECCERTIFICATE_H_
32 #define _SECURITY_SECCERTIFICATE_H_
34 #include <CoreFoundation/CFBase.h>
35 #include <CoreFoundation/CFArray.h>
36 #include <CoreFoundation/CFData.h>
37 #include <CoreFoundation/CFDate.h>
38 #include <CoreFoundation/CFError.h>
39 #include <Security/SecBase.h>
40 #include <Security/cssmtype.h>
41 #include <Security/x509defs.h>
42 #include <Availability.h>
43 #include <AvailabilityMacros.h>
45 #include <Security/SecTransform.h>
46 #include <Security/SecIdentity.h>
49 #if defined(__cplusplus)
53 CF_ASSUME_NONNULL_BEGIN
54 CF_IMPLICIT_BRIDGING_ENABLED
57 @enum CertificateItemAttributes
58 @abstract Indicates the type of a certificate item attribute.
59 @constant kSecSubjectItemAttr Indicates a DER-encoded subject distinguished name.
60 @constant kSecIssuerItemAttr Indicates a DER-encoded issuer distinguished name.
61 @constant kSecSerialNumberItemAttr Indicates a DER-encoded certificate serial number (without the tag and length).
62 @constant kSecPublicKeyHashItemAttr Indicates a public key hash.
63 @constant kSecSubjectKeyIdentifierItemAttr Indicates a subject key identifier.
64 @constant kSecCertTypeItemAttr Indicates a certificate type.
65 @constant kSecCertEncodingItemAttr Indicates a certificate encoding.
69 kSecSubjectItemAttr
= 'subj',
70 kSecIssuerItemAttr
= 'issu',
71 kSecSerialNumberItemAttr
= 'snbr',
72 kSecPublicKeyHashItemAttr
= 'hpky',
73 kSecSubjectKeyIdentifierItemAttr
= 'skid',
74 kSecCertTypeItemAttr
= 'ctyp',
75 kSecCertEncodingItemAttr
= 'cenc'
76 } /*DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER*/;
79 @function SecCertificateGetTypeID
80 @abstract Returns the type identifier of SecCertificate instances.
81 @result The CFTypeID of SecCertificate instances.
83 CFTypeID
SecCertificateGetTypeID(void)
84 __OSX_AVAILABLE_STARTING(__MAC_10_3
, __IPHONE_2_0
);
86 #pragma mark ---- Certificate Operations ----
89 @function SecCertificateCreateFromData
90 @abstract Creates a certificate based on the input data, type, and encoding.
91 @param data A pointer to the certificate data.
92 @param type The certificate type as defined in cssmtype.h.
93 @param encoding The certificate encoding as defined in cssmtype.h.
94 @param certificate On return, a reference to the newly created certificate.
95 @result A result code. See "Security Error Codes" (SecBase.h).
96 @discussion This API is deprecated in 10.7 Please use the SecCertificateCreateWithData API instead.
98 OSStatus
SecCertificateCreateFromData(const CSSM_DATA
*data
, CSSM_CERT_TYPE type
, CSSM_CERT_ENCODING encoding
, SecCertificateRef
* __nonnull CF_RETURNS_RETAINED certificate
)
99 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
102 @function SecCertificateCreateWithData
103 @abstract Create a certificate reference given its DER representation as a CFData.
104 @param allocator CFAllocator to allocate the certificate data. Pass NULL to use the default allocator.
105 @param certificate DER encoded X.509 certificate.
106 @result On return, a reference to the certificate. Returns NULL if the passed-in data is not a valid DER-encoded X.509 certificate.
109 SecCertificateRef
SecCertificateCreateWithData(CFAllocatorRef __nullable allocator
, CFDataRef data
)
110 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
113 @function SecCertificateAddToKeychain
114 @abstract Adds a certificate to the specified keychain.
115 @param certificate A reference to a certificate.
116 @param keychain A reference to the keychain in which to add the certificate. Pass NULL to add the certificate to the default keychain.
117 @result A result code. See "Security Error Codes" (SecBase.h).
118 @discussion This function is successful only if the certificate was created using the SecCertificateCreateFromData or
119 SecCertificateCreateWithData functions, and the certificate has not yet been added to the specified keychain.
121 OSStatus
SecCertificateAddToKeychain(SecCertificateRef certificate
, SecKeychainRef __nullable keychain
)
122 __OSX_AVAILABLE_STARTING(__MAC_10_3
, __IPHONE_NA
);
125 @function SecCertificateGetData
126 @abstract Retrieves the data for a given certificate.
127 @param certificate A reference to the certificate from which to retrieve the data.
128 @param data On return, the CSSM_DATA structure pointed to by data is filled in. You must allocate the space for a CSSM_DATA structure before calling this function. This data pointer is only guaranteed to remain valid as long as the certificate remains unchanged and valid.
129 @result A result code. See "Security Error Codes" (SecBase.h).
130 @discussion This API is deprecated in 10.7. Please use the SecCertificateCopyData API instead.
132 OSStatus
SecCertificateGetData(SecCertificateRef certificate
, CSSM_DATA_PTR data
)
133 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
136 @function SecCertificateCopyData
137 @abstract Returns the DER representation of an X.509 certificate.
138 @param certificate A reference to a certificate.
139 @result On return, a data reference containing the DER encoded representation of the X.509 certificate.
141 CFDataRef
SecCertificateCopyData(SecCertificateRef certificate
)
142 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
145 @function SecCertificateGetType
146 @abstract Retrieves the type for a given certificate.
147 @param certificate A reference to the certificate from which to obtain the type.
148 @param certificateType On return, the certificate type of the certificate. Certificate types are defined in cssmtype.h.
149 @result A result code. See "Security Error Codes" (SecBase.h).
150 @discussion This API is deprecated in 10.7. Please use the SecCertificateCopyValues API instead.
152 OSStatus
SecCertificateGetType(SecCertificateRef certificate
, CSSM_CERT_TYPE
*certificateType
)
153 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
156 @function SecCertificateGetSubject
157 @abstract Retrieves the subject name for a given certificate.
158 @param certificate A reference to the certificate from which to obtain the subject name.
159 @param subject On return, a pointer to a CSSM_X509_NAME struct which contains the subject's X.509 name (x509defs.h). This pointer remains valid until the certificate reference is released. The caller should not attempt to free this pointer.
160 @result A result code. See "Security Error Codes" (SecBase.h).
161 @discussion Prior to Mac OS X 10.5, this function did not return any output in the subject parameter. Your code should check the returned pointer value (in addition to the function result) before attempting to use it.
163 const CSSM_X509_NAME *subject = NULL;
164 OSStatus status = SecCertificateGetSubject(certificate, &subject);
165 if ( (status == errSecSuccess) && (subject != NULL) ) {
168 This API is deprecated in 10.7. Please use the SecCertificateCopyValues API instead.
170 OSStatus
SecCertificateGetSubject(SecCertificateRef certificate
, const CSSM_X509_NAME
* __nullable
* __nonnull subject
)
171 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
174 @function SecCertificateGetIssuer
175 @abstract Retrieves the issuer name for a given certificate.
176 @param certificate A reference to the certificate from which to obtain the issuer name.
177 @param issuer On return, a pointer to a CSSM_X509_NAME struct which contains the issuer's X.509 name (x509defs.h). This pointer remains valid until the certificate reference is released. The caller should not attempt to free this pointer.
178 @result A result code. See "Security Error Codes" (SecBase.h).
179 @discussion Prior to Mac OS X 10.5, this function did not return any output in the issuer parameter. Your code should check the returned pointer value (in addition to the function result) before attempting to use it.
181 const CSSM_X509_NAME *issuer = NULL;
182 OSStatus status = SecCertificateGetIssuer(certificate, &issuer);
183 if ( (status == errSecSuccess) && (issuer != NULL) ) {
186 This API is deprecated in 10.7. Please use the SecCertificateCopyValues API instead.
188 OSStatus
SecCertificateGetIssuer(SecCertificateRef certificate
, const CSSM_X509_NAME
* __nullable
* __nonnull issuer
)
189 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
192 @function SecCertificateGetCLHandle
193 @abstract Retrieves the certificate library handle for a given certificate.
194 @param certificate A reference to the certificate from which to obtain the certificate library handle.
195 @param clHandle On return, the certificate library handle of the given certificate. This handle remains valid at least as long as the certificate does.
196 @result A result code. See "Security Error Codes" (SecBase.h).
197 @discussion This API is deprecated in 10.7. Please use the SecCertificateCopyValues API instead.
199 OSStatus
SecCertificateGetCLHandle(SecCertificateRef certificate
, CSSM_CL_HANDLE
*clHandle
)
200 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
203 @function SecCertificateGetAlgorithmID
204 @abstract Retrieves the algorithm identifier for a given certificate.
205 @param certificate A reference to the certificate from which to retrieve the algorithm identifier.
206 @param algid On return, a pointer to a CSSM_X509_ALGORITHM_IDENTIFIER struct which identifies the algorithm for this certificate (x509defs.h). This pointer remains valid until the certificate reference is released. The caller should not attempt to free this pointer.
207 @result A result code. See "Security Error Codes" (SecBase.h).
208 discussion This API is deprecated in 10.7. Please use the SecCertificateCopyValues API instead.
210 OSStatus
SecCertificateGetAlgorithmID(SecCertificateRef certificate
, const CSSM_X509_ALGORITHM_IDENTIFIER
* __nullable
* __nonnull algid
)
211 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
214 @function SecCertificateCopyPublicKey
215 @abstract Retrieves the public key for a given certificate.
216 @param certificate A reference to the certificate from which to retrieve the public key.
217 @param key On return, a reference to the public key for the specified certificate. Your code must release this reference by calling the CFRelease function.
218 @result A result code. See "Security Error Codes" (SecBase.h).
220 OSStatus
SecCertificateCopyPublicKey(SecCertificateRef certificate
, SecKeyRef
* __nonnull CF_RETURNS_RETAINED key
)
221 __OSX_AVAILABLE_STARTING(__MAC_10_3
, __IPHONE_NA
);
224 @function SecCertificateCopyCommonName
225 @abstract Retrieves the common name of the subject of a given certificate.
226 @param certificate A reference to the certificate from which to retrieve the common name.
227 @param commonName On return, a reference to the common name. Your code must release this reference by calling the CFRelease function.
228 @result A result code. See "Security Error Codes" (SecBase.h).
229 @discussion All the data in this string comes from the certificate itself, and thus it's in whatever language the certificate itself is in.
230 Note that the certificate's common name field may not be present, or may be inadequate to describe the certificate; for display purposes,
231 you should consider using SecCertificateCopySubjectSummary instead of this function.
233 OSStatus
SecCertificateCopyCommonName(SecCertificateRef certificate
, CFStringRef
* __nonnull CF_RETURNS_RETAINED commonName
)
234 __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_NA
);
237 @function SecCertificateCopySubjectSummary
238 @abstract Returns a simple string which hopefully represents a human understandable summary.
239 @param certificate A reference to the certificate from which to derive the subject summary string.
240 @result On return, a reference to the subject summary string. Your code must release this reference by calling the CFRelease function.
241 @discussion All the data in this string comes from the certificate itself, and thus it's in whatever language the certificate itself is in.
243 CFStringRef
SecCertificateCopySubjectSummary(SecCertificateRef certificate
)
244 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
247 @function SecCertificateCopyEmailAddresses
248 @abstract Returns an array of zero or more email addresses for the subject of a given certificate.
249 @param certificate A reference to the certificate from which to retrieve the email addresses.
250 @param emailAddresses On return, an array of zero or more CFStringRef elements corresponding to each email address found.
251 Your code must release this array reference by calling the CFRelease function.
252 @result A result code. See "Security Error Codes" (SecBase.h).
254 OSStatus
SecCertificateCopyEmailAddresses(SecCertificateRef certificate
, CFArrayRef
* __nonnull CF_RETURNS_RETAINED emailAddresses
)
255 __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_NA
);
258 @function SecCertificateCopyPreference
259 @abstract Returns the preferred certificate for the specified name and key usage. If a preferred certificate does not exist for the specified name and key usage, NULL is returned.
260 @param name A string containing an email address (RFC822) or other name for which a preferred certificate is requested.
261 @param keyUsage A CSSM_KEYUSE key usage value, as defined in cssmtype.h. Pass 0 to ignore this parameter.
262 @param certificate On return, a reference to the preferred certificate, or NULL if none was found. You are responsible for releasing this reference by calling the CFRelease function.
263 @result A result code. See "Security Error Codes" (SecBase.h).
264 @discussion This function will typically be used to obtain the preferred encryption certificate for an email recipient.
265 This API is deprecated in 10.7. Please use the SecCertificateCopyPreferred API instead.
267 OSStatus
SecCertificateCopyPreference(CFStringRef name
, uint32 keyUsage
, SecCertificateRef
* __nonnull CF_RETURNS_RETAINED certificate
)
268 DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
271 @function SecCertificateCopyPreferred
272 @abstract Returns the preferred certificate for the specified name and key usage. If a preferred certificate does not exist for the specified name and key usage, NULL is returned.
273 @param name A string containing an email address (RFC822) or other name for which a preferred certificate is requested.
274 @param keyUsage A CFArrayRef value, containing items defined in SecItem.h Pass NULL to ignore this parameter. (kSecAttrCanEncrypt, kSecAttrCanDecrypt, kSecAttrCanDerive, kSecAttrCanSign, kSecAttrCanVerify, kSecAttrCanWrap, kSecAttrCanUnwrap)
275 @result On return, a reference to the preferred certificate, or NULL if none was found. You are responsible for releasing this reference by calling the CFRelease function.
276 @discussion This function will typically be used to obtain the preferred encryption certificate for an email recipient. If a preferred certificate has not been set
277 for the supplied name, the returned reference will be NULL. Your code should then perform a search for possible certificates, using the SecItemCopyMatching API.
280 SecCertificateRef
SecCertificateCopyPreferred(CFStringRef name
, CFArrayRef __nullable keyUsage
)
281 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
284 @function SecCertificateSetPreference
285 @abstract Sets the preferred certificate for a specified name, key usage, and date.
286 @param certificate A reference to the certificate which will be preferred.
287 @param name A string containing an email address (RFC822) or other name for which a preferred certificate will be associated.
288 @param keyUsage A CSSM_KEYUSE key usage value, as defined in cssmtype.h. Pass 0 to avoid specifying a particular key usage.
289 @param date (optional) A date reference. If supplied, the preferred certificate will be changed only if this date is later than the currently saved setting. Pass NULL if this preference should not be restricted by date.
290 @result A result code. See "Security Error Codes" (SecBase.h).
291 @discussion This function will typically be used to set the preferred encryption certificate for an email recipient, either manually (when encrypting email to a recipient) or automatically upon receipt of encrypted email.
292 This API is deprecated in 10.7. Plese use the SecCertificateSetPreferred API instead.
294 OSStatus
SecCertificateSetPreference(SecCertificateRef certificate
, CFStringRef name
, uint32 keyUsage
, CFDateRef __nullable date
)
295 __OSX_AVAILABLE_STARTING(__MAC_10_5
, __IPHONE_NA
);
298 @function SecCertificateSetPreferred
299 @abstract Sets the preferred certificate for a specified name and optional key usage.
300 @param certificate A reference to the preferred certificate. If NULL is passed, any existing preference for the specified name is cleared instead.
301 @param name A string containing an email address (RFC822) or other name for which a preferred certificate will be associated.
302 @param keyUsage A CFArrayRef value, containing items defined in SecItem.h Pass NULL to ignore this parameter. (kSecAttrCanEncrypt, kSecAttrCanDecrypt, kSecAttrCanDerive, kSecAttrCanSign, kSecAttrCanVerify, kSecAttrCanWrap, kSecAttrCanUnwrap)
303 @result A result code. See "Security Error Codes" (SecBase.h).
304 @discussion This function will typically be used to set the preferred encryption certificate for an email recipient, either manually (when encrypting email to a recipient)
305 or automatically upon receipt of encrypted email.
307 OSStatus
SecCertificateSetPreferred(SecCertificateRef __nullable certificate
, CFStringRef name
, CFArrayRef __nullable keyUsage
)
308 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
311 @enum kSecPropertyKey
312 @abstract Constants used to access dictionary entries returned by SecCertificateCopyValues
313 @constant kSecPropertyKeyType The type of the entry
314 @constant kSecPropertyKeyLabel The label of the entry
315 @constant kSecPropertyKeyLocalizedLabel The localized label of the entry
316 @constant kSecPropertyKeyValue The value of the entry
319 extern const CFStringRef kSecPropertyKeyType
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
320 extern const CFStringRef kSecPropertyKeyLabel
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
321 extern const CFStringRef kSecPropertyKeyLocalizedLabel
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
322 extern const CFStringRef kSecPropertyKeyValue
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
325 @enum kSecPropertyType
326 @abstract Public Constants for property list values returned by SecCertificateCopyValues
327 @discussion Note that kSecPropertyTypeTitle and kSecPropertyTypeError are defined in SecTrust.h
329 extern const CFStringRef kSecPropertyTypeWarning
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
330 extern const CFStringRef kSecPropertyTypeSuccess
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
331 extern const CFStringRef kSecPropertyTypeSection
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
332 extern const CFStringRef kSecPropertyTypeData
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
333 extern const CFStringRef kSecPropertyTypeString
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
334 extern const CFStringRef kSecPropertyTypeURL
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
335 extern const CFStringRef kSecPropertyTypeDate
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
338 @function SecCertificateCopyValues
339 @abstract Creates a dictionary that represents a certificate's contents.
340 @param certificate The certificate from which to get values
341 @param keys An array of string OID values, or NULL. If present, this is
342 the subset of values from the certificate to return. If NULL,
343 all values will be returned. Only OIDs that are top level keys
344 in the returned dictionary can be specified. Unknown OIDs are
346 @param error An optional pointer to a CFErrorRef. This value is
347 set if an error occurred. If not NULL the caller is
348 responsible for releasing the CFErrorRef.
349 @discussion The keys array will contain all of the keys used in the
350 returned dictionary. The top level keys in the returned
351 dictionary are OIDs, many of which are found in SecCertificateOIDs.h.
352 Each entry that is returned is itself a dictionary with four
353 entries, whose keys are kSecPropertyKeyType, kSecPropertyKeyLabel,
354 kSecPropertyKeyLocalizedLabel, kSecPropertyKeyValue. The label
355 entries may contain a descriptive (localized) string, or an
356 OID string. The kSecPropertyKeyType describes the type in the
357 value entry. The value entry may be any CFType, although it
358 is usually a CFStringRef, CFArrayRef or a CFDictionaryRef.
361 CFDictionaryRef
SecCertificateCopyValues(SecCertificateRef certificate
, CFArrayRef __nullable keys
, CFErrorRef
*error
)
362 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
365 @enum Transform Key Value Constants
366 @discussion Predefined values for the kSecTransformAttrCertificateUsage attribute.
369 kSecCertificateUsageSigning
370 kSecCertificateUsageSigningAndEncrypting
371 kSecCertificateUsageDeriveAndSign
375 extern const CFStringRef kSecCertificateUsageSigning
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
376 extern const CFStringRef kSecCertificateUsageSigningAndEncrypting
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
377 extern const CFStringRef kSecCertificateUsageDeriveAndSign
__OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
380 @function SecCertificateCopyLongDescription
381 @abstract Return the long description of a certificate
382 @param alloc The CFAllocator which should be used to allocate
383 memory for the dictionary and its storage for values. This
384 parameter may be NULL in which case the current default
385 CFAllocator is used. If this reference is not a valid
386 CFAllocator, the behavior is undefined.
387 @param certificate The certificate from which to retrieve the long description
388 @param error An optional pointer to a CFErrorRef. This value is
389 set if an error occurred. If not NULL the caller is
390 responsible for releasing the CFErrorRef.
391 @result A CFStringRef of the long description or NULL. If NULL and the error
392 parameter is supplied the error will be returned in the error parameter
393 @discussion Note that the format of this string may change in the future
397 CFStringRef
SecCertificateCopyLongDescription(CFAllocatorRef __nullable alloc
, SecCertificateRef certificate
, CFErrorRef
*error
)
398 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
401 @function SecCertificateCopyShortDescription
402 @abstract Return the short description of a certificate
403 @param alloc The CFAllocator which should be used to allocate
404 memory for the dictionary and its storage for values. This
405 parameter may be NULL in which case the current default
406 CFAllocator is used. If this reference is not a valid
407 CFAllocator, the behavior is undefined.
408 @param certificate The certificate from which to retrieve the short description
409 @param error An optional pointer to a CFErrorRef. This value is
410 set if an error occurred. If not NULL the caller is
411 responsible for releasing the CFErrorRef.
412 @result A CFStringRef of the short description or NULL. If NULL and the error
413 parameter is supplied the error will be returned in the error parameter
414 @discussion Note that the format of this string may change in the future
418 CFStringRef
SecCertificateCopyShortDescription(CFAllocatorRef __nullable alloc
, SecCertificateRef certificate
, CFErrorRef
*error
)
419 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
422 @function SecCertificateCopySerialNumber
423 @abstract Return the certificate's serial number.
424 @param certificate The certificate from which to get values
425 @param error An optional pointer to a CFErrorRef. This value is
426 set if an error occurred. If not NULL the caller is
427 responsible for releasing the CFErrorRef.
428 @discussion Return the content of a DER-encoded integer (without the
429 tag and length fields) for this certificate's serial
430 number. The caller must CFRelease the value returned.
434 CFDataRef
SecCertificateCopySerialNumber(SecCertificateRef certificate
, CFErrorRef
*error
)
435 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
438 @function SecCertificateCopyNormalizedIssuerContent
439 @abstract Return the certificate's normalized issuer
440 @param certificate The certificate from which to get values
441 @param error An optional pointer to a CFErrorRef. This value is
442 set if an error occurred. If not NULL the caller is
443 responsible for releasing the CFErrorRef.
444 @discussion The issuer is a sequence in the format used by
445 SecItemCopyMatching. The content returned is a DER-encoded
446 X.509 distinguished name. For a display version of the issuer,
447 call SecCertificateCopyValues. The caller must CFRelease
452 CFDataRef
SecCertificateCopyNormalizedIssuerContent(SecCertificateRef certificate
, CFErrorRef
*error
)
453 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
456 @function SecCertificateCopyNormalizedSubjectContent
457 @abstract Return the certificate's normalized subject
458 @param certificate The certificate from which to get values
459 @param error An optional pointer to a CFErrorRef. This value is
460 set if an error occurred. If not NULL the caller is
461 responsible for releasing the CFErrorRef.
462 @discussion The subject is a sequence in the format used by
463 SecItemCopyMatching. The content returned is a DER-encoded
464 X.509 distinguished name. For a display version of the subject,
465 call SecCertificateCopyValues. The caller must CFRelease
470 CFDataRef
SecCertificateCopyNormalizedSubjectContent(SecCertificateRef certificate
, CFErrorRef
*error
)
471 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
473 CF_IMPLICIT_BRIDGING_DISABLED
474 CF_ASSUME_NONNULL_END
476 #if defined(__cplusplus)
480 #endif /* !_SECURITY_SECCERTIFICATE_H_ */