2 * Copyright (c) 2007-2009,2012-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 SecImportExport
26 contains import/export functionality for keys and certificates.
29 #ifndef _SECURITY_SECIMPORTEXPORT_H_
30 #define _SECURITY_SECIMPORTEXPORT_H_
32 #include <Security/SecBase.h>
33 #include <CoreFoundation/CFBase.h>
34 #include <CoreFoundation/CFArray.h>
35 #include <CoreFoundation/CFData.h>
36 #include <CoreFoundation/CFDictionary.h>
40 CF_ASSUME_NONNULL_BEGIN
41 CF_IMPLICIT_BRIDGING_ENABLED
44 @enum Import/Export options
45 @discussion Predefined key constants used to pass in arguments to the
46 import/export functions
47 @constant kSecImportExportPassphrase Specifies a passphrase represented by
48 a CFStringRef to be used to encrypt/decrypt.
50 extern const CFStringRef kSecImportExportPassphrase
51 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
54 @enum Import/Export item description
55 @discussion Predefined key constants used to pass back a CFArray with a
56 CFDictionary per item.
58 @constant kSecImportItemLabel a CFStringRef representing the item label.
59 This implementation specific identifier cannot be expected to have
61 @constant kSecImportItemKeyID a CFDataRef representing the key id. Often
62 the SHA-1 digest of the public key.
63 @constant kSecImportItemIdentity a SecIdentityRef representing the identity.
64 @constant kSecImportItemTrust a SecTrustRef set up with all relevant
65 certificates. Not guaranteed to succesfully evaluate.
66 @constant kSecImportItemCertChain a CFArrayRef holding all relevant
67 certificates for this item's identity
69 extern const CFStringRef kSecImportItemLabel
70 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
71 extern const CFStringRef kSecImportItemKeyID
72 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
73 extern const CFStringRef kSecImportItemTrust
74 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
75 extern const CFStringRef kSecImportItemCertChain
76 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
77 extern const CFStringRef kSecImportItemIdentity
78 __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
81 @function SecPKCS12Import
82 @abstract return contents of a PKCS#12 formatted blob.
83 @param pkcs12_data PKCS#12 formatted data
84 @param options Dictionary containing options for decode. A
85 kSecImportExportPassphrase is required at a minimum. Only password-
86 based PKCS#12 blobs are currently supported.
87 @param items Array containing a dictionary for every item extracted. See
88 kSecImportItem constants.
89 @result errSecSuccess in case of success. errSecDecode means either the
90 blob can't be read or it is malformed. errSecAuthFailed means an
91 incorrect password was passed, or data in the container got damaged.
93 OSStatus
SecPKCS12Import(CFDataRef pkcs12_data
, CFDictionaryRef options
,
94 CFArrayRef
* __nonnull CF_RETURNS_RETAINED items
) __OSX_AVAILABLE_STARTING(__MAC_10_6
, __IPHONE_2_0
);
96 CF_IMPLICIT_BRIDGING_DISABLED
101 #endif /* !_SECURITY_SECIMPORTEXPORT_H_ */