]> git.saurik.com Git - apple/security.git/blame - keychain/SecureObjectSync/SOSRing.h
Security-59754.80.3.tar.gz
[apple/security.git] / keychain / SecureObjectSync / SOSRing.h
CommitLineData
5c19dc3a
A
1//
2// SOSRing.h
3// sec
4//
5// Created by Richard Murphy on 3/3/15.
6//
7//
8
9#ifndef _sec_SOSRing_
10#define _sec_SOSRing_
11
12#include <CoreFoundation/CoreFoundation.h>
13#include <Security/SecureObjectSync/SOSCloudCircle.h>
b54c578e
A
14#include "keychain/SecureObjectSync/SOSGenCount.h"
15#include "keychain/SecureObjectSync/SOSFullPeerInfo.h"
16#include "keychain/SecureObjectSync/SOSConcordanceTrust.h"
5c19dc3a 17#include <Security/SecureObjectSync/SOSBackupSliceKeyBag.h>
5c19dc3a
A
18#include <Security/SecKey.h>
19
20typedef struct __OpaqueSOSRing *SOSRingRef;
21
22enum {
23 kSOSRingMember = 0,
24 kSOSRingNotInRing = 1,
25 kSOSRingApplicant = 2,
26 kSOSRingReject = 3,
27 kSOSRingRetired = 4,
28 kSOSRingError = 99,
29};
30typedef int SOSRingStatus;
31
32enum {
33 kSOSRingBase = 0,
34 kSOSRingBackup = 1,
35 kSOSRingPeerKeyed = 2,
36 kSOSRingEntropyKeyed = 3,
37 kSOSRingPKKeyed = 4,
6b200bc3
A
38 kSOSRingRecovery = 5,
39 kSOSRingTypeCount = 6,
5c19dc3a
A
40 kSOSRingTypeError = 0xfbad,
41};
42typedef uint32_t SOSRingType;
43
5c19dc3a
A
44CFTypeID SOSRingGetTypeID(void);
45
46SOSRingRef SOSRingCreate(CFStringRef name, CFStringRef myPeerID, SOSRingType type, CFErrorRef *error);
47bool SOSRingResetToEmpty(SOSRingRef ring, CFStringRef myPeerID, CFErrorRef *error);
5c19dc3a
A
48bool SOSRingGenerationSign(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
49bool SOSRingConcordanceSign(SOSRingRef ring, SOSFullPeerInfoRef requestor, CFErrorRef *error);
50SOSConcordanceStatus SOSRingConcordanceTrust(SOSFullPeerInfoRef me, CFSetRef peers,
51 SOSRingRef knownRing, SOSRingRef proposedRing,
52 SecKeyRef knownPubkey, SecKeyRef userPubkey,
53 CFStringRef excludePeerID, CFErrorRef *error);
54bool SOSRingAccept(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
55bool SOSRingReject(SOSRingRef ring, SecKeyRef user_privkey, SOSFullPeerInfoRef requestor, CFErrorRef *error);
56bool SOSRingSetPayload(SOSRingRef ring, SecKeyRef user_privkey, CFDataRef payload, SOSFullPeerInfoRef requestor, CFErrorRef *error);
57CFDataRef SOSRingGetPayload(SOSRingRef ring, CFErrorRef *error);
58CFSetRef SOSRingGetBackupViewset(SOSRingRef ring, CFErrorRef *error);
b54c578e 59CFStringRef SOSRingGetBackupView(SOSRingRef ring, CFErrorRef *error);
5c19dc3a
A
60
61bool SOSRingSetBackupKeyBag(SOSRingRef ring, SOSFullPeerInfoRef fpi, CFSetRef viewSet, SOSBackupSliceKeyBagRef bskb, CFErrorRef *error);
62
63SOSBackupSliceKeyBagRef SOSRingCopyBackupSliceKeyBag(SOSRingRef ring, CFErrorRef *error);
64
65bool SOSRingPeerTrusted(SOSRingRef ring, SOSFullPeerInfoRef requestor, CFErrorRef *error);
66bool SOSRingPKTrusted(SOSRingRef ring, SecKeyRef pubkey, CFErrorRef *error);
67
68CFDataRef SOSRingCopyEncodedData(SOSRingRef ring, CFErrorRef *error);
69SOSRingRef SOSRingCreateFromData(CFErrorRef* error, CFDataRef ring_data);
70
71CFStringRef SOSRingGetName(SOSRingRef ring);
72uint32_t SOSRingGetType(SOSRingRef ring);
73SOSGenCountRef SOSRingGetGeneration(SOSRingRef ring);
74uint32_t SOSRingGetVersion(SOSRingRef ring);
75CFStringRef SOSRingGetIdentifier(SOSRingRef ring);
76CFStringRef SOSRingGetLastModifier(SOSRingRef ring);
77
78CFMutableSetRef SOSRingGetApplicants(SOSRingRef ring);
79
80static inline bool isSOSRing(CFTypeRef object) {
81 return object && (CFGetTypeID(object) == SOSRingGetTypeID());
82}
83
84bool SOSBackupRingSetViews(SOSRingRef ring, SOSFullPeerInfoRef requestor, CFSetRef viewSet, CFErrorRef *error);
85CFSetRef SOSBackupRingGetViews(SOSRingRef ring, CFErrorRef *error);
86
87#endif /* defined(_sec_SOSRing_) */