]> git.saurik.com Git - apple/security.git/blob - OSX/sec/ProjectHeaders/Security/SecureObjectSync/SOSBackupSliceKeyBag.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / sec / ProjectHeaders / Security / SecureObjectSync / SOSBackupSliceKeyBag.h
1 /*
2 * Copyright (c) 2015 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 SOSBackupSliceKeyBag.h - View Bags - backup bags for views
26 */
27
28 #ifndef _sec_SOSBackupSliceKeyBag_
29 #define _sec_SOSBackupSliceKeyBag_
30
31 #include <CoreFoundation/CoreFoundation.h>
32 #include <Security/SecureObjectSync/SOSPeerInfo.h>
33
34 // We don't have a portable header (particularly for the SIM) so for now we define the one type we need.
35 // This should be fixed when we get a portable AKS interface.
36 typedef int32_t bskb_keybag_handle_t;
37
38 typedef struct __OpaqueSOSBackupSliceKeyBag *SOSBackupSliceKeyBagRef;
39
40 CFTypeRef SOSBackupSliceKeyBageGetTypeID(void);
41
42 SOSBackupSliceKeyBagRef SOSBackupSliceKeyBagCreate(CFAllocatorRef allocator, CFSetRef peers, CFErrorRef* error);
43 SOSBackupSliceKeyBagRef SOSBackupSliceKeyBagCreateDirect(CFAllocatorRef allocator, CFDataRef aks_bag, CFErrorRef *error);
44
45 SOSBackupSliceKeyBagRef SOSBackupSliceKeyBagCreateFromData(CFAllocatorRef allocator, CFDataRef data, CFErrorRef *error);
46
47 CFDataRef SOSBSKBCopyEncoded(SOSBackupSliceKeyBagRef BackupSliceKeyBag, CFErrorRef* error);
48
49 //
50 bool SOSBSKBIsDirect(SOSBackupSliceKeyBagRef backupSliceKeyBag);
51
52 CFSetRef SOSBSKBGetPeers(SOSBackupSliceKeyBagRef backupSliceKeyBag);
53
54
55 // Keybag fetching
56 CFDataRef SOSBSKBCopyAKSBag(SOSBackupSliceKeyBagRef backupSliceKeyBag, CFErrorRef* error);
57
58
59 // Der encoding
60 const uint8_t* der_decode_BackupSliceKeyBag(CFAllocatorRef allocator,
61 SOSBackupSliceKeyBagRef* BackupSliceKeyBag, CFErrorRef *error,
62 const uint8_t* der, const uint8_t *der_end);
63
64 size_t der_sizeof_BackupSliceKeyBag(SOSBackupSliceKeyBagRef BackupSliceKeyBag, CFErrorRef *error);
65 uint8_t* der_encode_BackupSliceKeyBag(SOSBackupSliceKeyBagRef BackupSliceKeyBag, CFErrorRef *error,
66 const uint8_t *der, uint8_t *der_end);
67
68 bskb_keybag_handle_t SOSBSKBLoadAndUnlockWithPeerIDAndSecret(SOSBackupSliceKeyBagRef backupSliceKeyBag,
69 CFStringRef peerID, CFDataRef peerSecret,
70 CFErrorRef *error);
71
72 bskb_keybag_handle_t SOSBSKBLoadAndUnlockWithPeerSecret(SOSBackupSliceKeyBagRef backupSliceKeyBag,
73 SOSPeerInfoRef peer, CFDataRef peerSecret,
74 CFErrorRef *error);
75
76 bskb_keybag_handle_t SOSBSKBLoadAndUnlockWithDirectSecret(SOSBackupSliceKeyBagRef backupSliceKeyBag,
77 CFDataRef directSecret,
78 CFErrorRef *error);
79
80 // Utilities for backup keys
81 bool SOSBSKBIsGoodBackupPublic(CFDataRef publicKey, CFErrorRef *error);
82
83 #endif /* defined(_sec_SOSBackupSliceKeyBag_) */