]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/lib/SecRecoveryPassword.h
Security-57740.60.18.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecRecoveryPassword.h
1 /*
2 * Copyright (c) 2010-2012 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 * generalize to Sec function
26 */
27
28 #ifndef SEC_RECOVERYPASSWORD_H
29 #define SEC_RECOVERYPASSWORD_H
30
31 #include <stdint.h>
32 #include <stddef.h>
33 #include <CoreFoundation/CoreFoundation.h>
34 #include <Availability.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 extern CFStringRef kSecRecVersionNumber,
41 kSecRecQuestions,
42 kSecRecLocale,
43 kSecRecIV,
44 kSecRecWrappedPassword;
45
46 /*!
47 @function SecWrapRecoveryPasswordWithAnswers
48 @abstract Wrap a password with a key derived from an array of answers to questions
49
50 @param password The password to wrap.
51
52 @param questions An array containing the questions corresponding to the answers.
53
54 @param answers An array of CFStringRefs for each of the answers.
55
56 @result A CFDictionary with values for each of the keys defined for a recovery reference:
57
58 kSecRecVersionNumber - the version of recovery reference
59 kSecRecQuestions - the questions
60 kSecRecLocale - the locale of the system used to generate the answers
61 kSecRecIV - the IV for the password wrapping (base64)
62 kSecRecWrappedPassword - the wrapped password bytes (base64)
63 */
64
65 CFDictionaryRef
66 SecWrapRecoveryPasswordWithAnswers(CFStringRef password, CFArrayRef questions, CFArrayRef answers)
67 __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
68
69 /*!
70 @function SecUnwrapRecoveryPasswordWithAnswers
71 @abstract Unwrap a password with a key derived from an array of answers to questions
72
73 @param recref A CFDictionary containing the recovery reference as defined above.
74
75 @param answers An array of CFStringRefs for each of the answers.
76
77 @result The unwrapped password
78
79 */
80
81 CFStringRef
82 SecUnwrapRecoveryPasswordWithAnswers(CFDictionaryRef recref, CFArrayRef answers)
83 __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
84
85 /*!
86 @function SecCreateRecoveryPassword
87 @abstract This function creates a random password of the form:
88 T2YG-WEGQ-WVFX-A37A-I3OM-NQKV
89
90 @result The password
91
92 */
93
94 CFStringRef
95 SecCreateRecoveryPassword(void)
96 __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
97
98
99
100
101 #ifdef __cplusplus
102 }
103 #endif
104 #endif /* SEC_RECOVERYPASSWORD_H */
105
106