2 * Copyright (c) 2010 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 * generalize to Sec function
28 #ifndef SEC_RECOVERYPASSWORD_H
29 #define SEC_RECOVERYPASSWORD_H
33 #include <CoreFoundation/CoreFoundation.h>
34 #include <Availability.h>
40 extern CFStringRef kSecRecVersionNumber
,
44 kSecRecWrappedPassword
;
47 @function SecWrapRecoveryPasswordWithAnswers
48 @abstract Wrap a password with a key derived from an array of answers to questions
50 @param password The password to wrap.
52 @param questions An array containing the questions corresponding to the answers.
54 @param answers An array of CFStringRefs for each of the answers.
56 @result A CFDictionary with values for each of the keys defined for a recovery reference:
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)
66 SecWrapRecoveryPasswordWithAnswers(CFStringRef password
, CFArrayRef questions
, CFArrayRef answers
)
67 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
70 @function SecUnwrapRecoveryPasswordWithAnswers
71 @abstract Unwrap a password with a key derived from an array of answers to questions
73 @param recref A CFDictionary containing the recovery reference as defined above.
75 @param answers An array of CFStringRefs for each of the answers.
77 @result The unwrapped password
82 SecUnwrapRecoveryPasswordWithAnswers(CFDictionaryRef recref
, CFArrayRef answers
)
83 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
86 @function SecCreateRecoveryPassword
87 @abstract This function creates a random password of the form:
88 T2YG-WEGQ-WVFX-A37A-I3OM-NQKV
95 SecCreateRecoveryPassword(void)
96 __OSX_AVAILABLE_STARTING(__MAC_10_7
, __IPHONE_NA
);
104 #endif /* SEC_RECOVERYPASSWORD_H */