]> git.saurik.com Git - apple/security.git/blob - sec/Security/SecCertificate.h
Security-55163.44.tar.gz
[apple/security.git] / sec / Security / SecCertificate.h
1 /*
2 * Copyright (c) 2006-2009 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*!
25 @header SecCertificate
26 The functions provided in SecCertificate.h implement and manage a
27 particular type of keychain item that represents a X.509 public key
28 certificate. You can store a certificate in a keychain, but a
29 certificate can also be a transient object.
30
31 You can use a certificate as a keychain item in most functions.
32 */
33
34 #ifndef _SECURITY_SECCERTIFICATE_H_
35 #define _SECURITY_SECCERTIFICATE_H_
36
37 #include <Security/SecBase.h>
38 #include <CoreFoundation/CFData.h>
39
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43
44 /*!
45 @function SecCertificateGetTypeID
46 @abstract Returns the type identifier of SecCertificate instances.
47 @result The CFTypeID of SecCertificate instances.
48 */
49 CFTypeID SecCertificateGetTypeID(void)
50 __OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
51
52 /*!
53 @function SecCertificateCreateWithData
54 @abstract Create a certificate given it's DER representation as a CFData.
55 @param allocator CFAllocator to allocate the certificate with.
56 @param certificate DER encoded X.509 certificate.
57 @result Return NULL if the passed-in data is not a valid DER-encoded
58 X.509 certificate, return a SecCertificateRef otherwise.
59 */
60 SecCertificateRef SecCertificateCreateWithData(CFAllocatorRef allocator,
61 CFDataRef data) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
62
63 /*!
64 @function SecCertificateCopyData
65 @abstract Return the DER representation of an X.509 certificate.
66 @param certificate SecCertificate object created with
67 SecCertificateCreateWithData().
68 @result DER encoded X.509 certificate.
69 */
70 CFDataRef SecCertificateCopyData(SecCertificateRef certificate)
71 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
72
73 /*!
74 @function SecCertificateCopySubjectSummary
75 @abstract Return a simple string which hopefully represents a human
76 understandable summary.
77 @param certificate SecCertificate object created with
78 SecCertificateCreateWithData().
79 @discussion All the data in this string comes from the certificate itself
80 and thus it's in whatever language the certificate itself is in.
81 @result A CFStringRef which the caller should CFRelease() once it's no
82 longer needed.
83 */
84 CFStringRef SecCertificateCopySubjectSummary(SecCertificateRef certificate)
85 __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_2_0);
86
87 #if defined(__cplusplus)
88 }
89 #endif
90
91 #endif /* !_SECURITY_SECCERTIFICATE_H_ */