]> git.saurik.com Git - apple/security.git/blob - keychain/headers/SecIdentityPriv.h
Security-59754.41.1.tar.gz
[apple/security.git] / keychain / headers / SecIdentityPriv.h
1 /*
2 * Copyright (c) 2002-2011,2012-2013,2016 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 SecIdentityPriv
26 The functions provided in SecIdentityPriv.h implement a convenient way to
27 match private keys with certificates.
28 */
29
30 #ifndef _SECURITY_SECIDENTITYPRIV_H_
31 #define _SECURITY_SECIDENTITYPRIV_H_
32
33 #include <Security/SecBase.h>
34 #include <Security/SecBasePriv.h>
35 #include <CoreFoundation/CFBase.h>
36
37 __BEGIN_DECLS
38
39 /*! @function SecIdentityCreate
40 @abstract create a new identity object from the provided certificate and its associated private key.
41 @param allocator CFAllocator to allocate the identity object. Pass NULL to use the default allocator.
42 @param certificate A certificate reference.
43 @param privateKey A private key reference.
44 @result An identity reference.
45 */
46 SecIdentityRef SecIdentityCreate(
47 CFAllocatorRef allocator,
48 SecCertificateRef certificate,
49 SecKeyRef privateKey)
50 __SEC_MAC_AND_IOS_UNKNOWN;
51 //__OSX_AVAILABLE_STARTING(__MAC_10_3, __SEC_IPHONE_UNKNOWN);
52
53 #if SEC_OS_OSX
54 /*!
55 @function ConvertArrayToKeyUsage
56 @abstract Given an array of key usages defined in SecItem.h return the equivalent CSSM_KEYUSE
57 @param usage An CFArrayRef containing CFTypeRefs defined in SecItem.h
58 kSecAttrCanEncrypt,
59 kSecAttrCanDecrypt,
60 kSecAttrCanDerive,
61 kSecAttrCanSign,
62 kSecAttrCanVerify,
63 kSecAttrCanWrap,
64 kSecAttrCanUnwrap
65 If the CFArrayRef is NULL then the CSSM_KEYUSAGE will be CSSM_KEYUSE_ANY
66 @result A CSSM_KEYUSE. Derived from the passed in Array
67 */
68 CSSM_KEYUSE ConvertArrayToKeyUsage(CFArrayRef usage)
69 __SEC_MAC_ONLY_UNKNOWN;
70 #endif // SEC_OS_OSX
71
72 __END_DECLS
73
74 #endif /* _SECURITY_SECIDENTITYPRIV_H_ */