]> git.saurik.com Git - apple/security.git/blame - OSX/libsecurity_keychain/lib/SecRecoveryPassword.h
Security-58286.51.6.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / lib / SecRecoveryPassword.h
CommitLineData
b1ab9ed8 1/*
d8f41ccd 2 * Copyright (c) 2010-2012 Apple Inc. All Rights Reserved.
b1ab9ed8
A
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
37extern "C" {
38#endif
39
40extern 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
866f8763 65CFDictionaryRef CF_RETURNS_RETAINED
b1ab9ed8
A
66SecWrapRecoveryPasswordWithAnswers(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
866f8763 81CFStringRef CF_RETURNS_RETAINED
b1ab9ed8
A
82SecUnwrapRecoveryPasswordWithAnswers(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
94CFStringRef
427c49bc 95SecCreateRecoveryPassword(void)
b1ab9ed8
A
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