5 // Created by Richard Murphy on 3/3/15.
12 #include <CoreFoundation/CoreFoundation.h>
13 #include <Security/SecureObjectSync/SOSCloudCircle.h>
14 #include <Security/SecureObjectSync/SOSGenCount.h>
15 #include <Security/SecureObjectSync/SOSFullPeerInfo.h>
16 #include <Security/SecureObjectSync/SOSConcordanceTrust.h>
17 #include <Security/SecureObjectSync/SOSBackupSliceKeyBag.h>
19 #include <Security/SecKey.h>
21 typedef struct __OpaqueSOSRing
*SOSRingRef
;
25 kSOSRingNotInRing
= 1,
26 kSOSRingApplicant
= 2,
31 typedef int SOSRingStatus
;
36 kSOSRingPeerKeyed
= 2,
37 kSOSRingEntropyKeyed
= 3,
39 kSOSRingTypeCount
= 5,
40 kSOSRingTypeError
= 0xfbad,
42 typedef uint32_t SOSRingType
;
45 CFTypeID
SOSRingGetTypeID(void);
47 SOSRingRef
SOSRingCreate(CFStringRef name
, CFStringRef myPeerID
, SOSRingType type
, CFErrorRef
*error
);
48 bool SOSRingResetToEmpty(SOSRingRef ring
, CFStringRef myPeerID
, CFErrorRef
*error
);
49 bool SOSRingResetToOffering(SOSRingRef ring
, __unused SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
50 SOSRingStatus
SOSRingDeviceIsInRing(SOSRingRef ring
, CFStringRef peerID
);
51 bool SOSRingApply(SOSRingRef ring
, SecKeyRef user_pubkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
52 bool SOSRingWithdraw(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
53 bool SOSRingGenerationSign(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
54 bool SOSRingConcordanceSign(SOSRingRef ring
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
55 SOSConcordanceStatus
SOSRingConcordanceTrust(SOSFullPeerInfoRef me
, CFSetRef peers
,
56 SOSRingRef knownRing
, SOSRingRef proposedRing
,
57 SecKeyRef knownPubkey
, SecKeyRef userPubkey
,
58 CFStringRef excludePeerID
, CFErrorRef
*error
);
59 bool SOSRingAccept(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
60 bool SOSRingReject(SOSRingRef ring
, SecKeyRef user_privkey
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
61 bool SOSRingSetPayload(SOSRingRef ring
, SecKeyRef user_privkey
, CFDataRef payload
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
62 CFDataRef
SOSRingGetPayload(SOSRingRef ring
, CFErrorRef
*error
);
63 CFSetRef
SOSRingGetBackupViewset(SOSRingRef ring
, CFErrorRef
*error
);
65 bool SOSRingSetBackupKeyBag(SOSRingRef ring
, SOSFullPeerInfoRef fpi
, CFSetRef viewSet
, SOSBackupSliceKeyBagRef bskb
, CFErrorRef
*error
);
67 SOSBackupSliceKeyBagRef
SOSRingCopyBackupSliceKeyBag(SOSRingRef ring
, CFErrorRef
*error
);
69 bool SOSRingPeerTrusted(SOSRingRef ring
, SOSFullPeerInfoRef requestor
, CFErrorRef
*error
);
70 bool SOSRingPKTrusted(SOSRingRef ring
, SecKeyRef pubkey
, CFErrorRef
*error
);
72 CFDataRef
SOSRingCopyEncodedData(SOSRingRef ring
, CFErrorRef
*error
);
73 SOSRingRef
SOSRingCreateFromData(CFErrorRef
* error
, CFDataRef ring_data
);
75 CFStringRef
SOSRingGetName(SOSRingRef ring
);
76 uint32_t SOSRingGetType(SOSRingRef ring
);
77 SOSGenCountRef
SOSRingGetGeneration(SOSRingRef ring
);
78 uint32_t SOSRingGetVersion(SOSRingRef ring
);
79 CFStringRef
SOSRingGetIdentifier(SOSRingRef ring
);
80 CFStringRef
SOSRingGetLastModifier(SOSRingRef ring
);
82 CFMutableSetRef
SOSRingGetApplicants(SOSRingRef ring
);
84 static inline bool isSOSRing(CFTypeRef object
) {
85 return object
&& (CFGetTypeID(object
) == SOSRingGetTypeID());
88 bool SOSBackupRingSetViews(SOSRingRef ring
, SOSFullPeerInfoRef requestor
, CFSetRef viewSet
, CFErrorRef
*error
);
89 CFSetRef
SOSBackupRingGetViews(SOSRingRef ring
, CFErrorRef
*error
);
91 #endif /* defined(_sec_SOSRing_) */