2 * Copyright (c) 2012-2014 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@
28 #ifndef _SECURITY_SOSCLOUDCIRCLE_H_
29 #define _SECURITY_SOSCLOUDCIRCLE_H_
31 #include <CoreFoundation/CoreFoundation.h>
32 #include <CoreFoundation/CFArray.h>
33 #include <CoreFoundation/CFSet.h>
34 #include <CoreFoundation/CFError.h>
36 #include <Security/SecureObjectSync/SOSTypes.h>
37 #include <Security/SecureObjectSync/SOSPeerInfo.h>
43 // CFError info for propogated errors
46 extern const CFStringRef kSOSErrorDomain
;
49 kSOSErrorPrivateKeyAbsent
= 1,
50 kSOSErrorPublicKeyAbsent
= 2,
52 kSOSErrorWrongPassword
= 3,
54 kSOSErrorNotReady
= 4, // System not yet ready (before first unlock)
56 kSOSErrorIncompatibleCircle
= 5, // We saw an incompatible circle out there.
57 kSOSInitialSyncFailed
=6, //we timed out when syncing during approving from another device
66 kSOSCCNotInCircle
= 1,
67 kSOSCCRequestPending
= 2,
68 kSOSCCCircleAbsent
= 3,
72 typedef int SOSCCStatus
;
74 extern const char * kSOSCCCircleChangedNotification
;
75 extern const char * kSOSCCViewMembershipChangedNotification
;
76 extern const char * kSOSCCInitialSyncChangedNotification
;
77 extern const char * kSOSCCHoldLockForInitialSync
;
78 extern const char * kSOSCCPeerAvailable
;
79 extern const char * kSOSCCRecoveryKeyChanged
;
81 @function SOSCCSetUserCredentials
82 @abstract Uses the user authentication credential (password) to create an internal EC Key Pair for authenticating Circle changes.
83 @param user_label This string can be used for a label to tag the resulting credential data for persistent storage.
84 @param user_password The user's password that's used as input to generate EC keys for Circle authenticating operations.
85 @param error What went wrong if we returned false.
86 @discussion This call needs to be made whenever a call that updates a Cloud Circle returns an error of kSOSErrorPrivateKeyAbsent (credential timeout) or kSOSErrorPublicKeyAbsent (programmer error).
88 Any caller to SetUserCredential is asserting that they know the credential is correct.
90 If you are uncertain (unable to verify) use TryUserCredentials, but if you can know it's better
91 to call Set so we can recover from password change.
94 bool SOSCCSetUserCredentials(CFStringRef user_label
, CFDataRef user_password
, CFErrorRef
* error
);
98 @function SOSCCSetUserCredentialsAndDSID
99 @abstract Uses the user authentication credential (password) to create an internal EC Key Pair for authenticating Circle changes. Passes the DSID to ensure user credentials are passed to the correct account.
100 @param user_label This string can be used for a label to tag the resulting credential data for persistent storage.
101 @param user_password The user's password that's used as input to generate EC keys for Circle authenticating operations.
102 @param dsid This is a string of a dsid associated with an account
103 @param error What went wrong if we returned false.
104 @discussion This call needs to be made whenever a call that updates a Cloud Circle returns an error of kSOSErrorPrivateKeyAbsent (credential timeout) or kSOSErrorPublicKeyAbsent (programmer error).
106 Any caller to SetUserCredential is asserting that they know the credential is correct.
108 If you are uncertain (unable to verify) use TryUserCredentials, but if you can know it's better
109 to call Set so we can recover from password change.
112 bool SOSCCSetUserCredentialsAndDSID(CFStringRef user_label
, CFDataRef user_password
, CFStringRef dsid
, CFErrorRef
*error
);
115 @function SOSCCTryUserCredentials
116 @abstract Uses the user authentication credential (password) to create an internal EC Key Pair for authenticating Circle changes.
117 @param user_label This string can be used for a label to tag the resulting credential data for persistent storage.
118 @param user_password The user's password that's used as input to generate EC keys for Circle authenticating operations.
119 @param error What went wrong if we returned false.
120 @discussion When one of the user credential requiring calls below (almost all) need a credential it will fail with kSOSErrorPrivateKeyAbsent. If you don't have an outside way to confirm correctness of the password we will attempt to use the passed in value and if it doesn't match the public information we currently have we'll fail.
123 bool SOSCCTryUserCredentials(CFStringRef user_label
, CFDataRef user_password
, CFErrorRef
* error
);
126 @function SOSCCCopyDeviceID
127 @abstract Retrieves this device's IDS device ID
128 @param error What went wrong if we returned false
130 CFStringRef
SOSCCCopyDeviceID(CFErrorRef
* error
);
133 @function SOSCCSetDeviceID
134 @abstract Sets this device's IDS device ID
135 @param IDS The ID to set
136 @param error What went wrong if we returned false
138 bool SOSCCSetDeviceID(CFStringRef IDS
, CFErrorRef
* error
);
141 @function SOSCCRegisterUserCredentials
142 @abstract Deprecated name for SOSCCSetUserCredentials.
144 bool SOSCCRegisterUserCredentials(CFStringRef user_label
, CFDataRef user_password
, CFErrorRef
*error
);
147 @function SOSCCWaitForInitialSync
148 @abstract returns true if it waited, false if we didn't due to some error
149 @param error Error ref
150 @return if we waited successfully
152 bool SOSCCWaitForInitialSync(CFErrorRef
* error
);
155 @function SOSCCCopyYetToSyncViewsList
156 @abstract returns views not yet synced
157 @param error error to fill in if we have one
158 @return List of view names that we haven't synced yet.
160 CFArrayRef
SOSCCCopyYetToSyncViewsList(CFErrorRef
* error
);
163 @function SOSCCCanAuthenticate
164 @abstract Determines whether we currently have valid credentials to authenticate a circle operation.
165 @param error What went wrong if we returned false.
168 bool SOSCCCanAuthenticate(CFErrorRef
*error
);
171 @function SOSCCThisDeviceIsInCircle
172 @abstract Finds and returns if this devices status in the user's circle.
173 @param error What went wrong if we returned kSOSCCError.
174 @result kSOSCCInCircle if we're in the circle.
175 @discussion If we have an error figuring out if we're in the circle we return false and the error.
177 SOSCCStatus
SOSCCThisDeviceIsInCircle(CFErrorRef
* error
);
180 @function SOSCCIsIcloudKeychainSyncing
181 @abstract determines whether baseline keychain syncing is occuring (V0/V2)
182 @result true if we're in the circle and baseline keychain syncing views
183 (kSOSViewAutofillPasswords/kSOSViewSafariCreditCards/kSOSViewWiFi/kSOSViewOtherSyncable
184 are enabled. false otherwise.
187 bool SOSCCIsIcloudKeychainSyncing(void);
190 @function SOSCCIsSafariSyncing
191 @abstract determines whether Safari keychain item syncing is occuring (kSOSViewAutofillPasswords/kSOSViewSafariCreditCards)
192 @result true if we're in the circle and the kSOSViewAutofillPasswords/kSOSViewSafariCreditCards views are enabled. false otherwise.
195 bool SOSCCIsSafariSyncing(void);
198 @function SOSCCIsAppleTVSyncing
199 @abstract determines whether appleTV keychain syncing is occuring (kSOSViewAppleTV)
200 @result true if we're in the circle and the kSOSViewAppleTV view is enabled. false otherwise.
203 bool SOSCCIsAppleTVSyncing(void);
207 @function SOSCCIsHomeKitSyncing
208 @abstract determines whether homekit keychain syncing is occuring (kSOSViewHomeKit)
209 @result true if we're in the circle and the kSOSViewHomeKit view is enabled. false otherwise.
212 bool SOSCCIsHomeKitSyncing(void);
216 @function SOSCCIsWiFiSyncing
217 @abstract determines whether WiFi keychain syncing is occuring (kSOSViewWiFi)
218 @result true if we're in the circle and the kSOSViewWiFi view is enabled. false otherwise.
221 bool SOSCCIsWiFiSyncing(void);
224 @function SOSCCIsContinuityUnlockSyncing
225 @abstract determines whether Continuity Unlock keychain syncing is occuring (kSOSViewContinuityUnlock)
226 @result true if we're in the circle and the kSOSViewContinuityUnlock view is enabled. false otherwise.
230 bool SOSCCIsContinuityUnlockSyncing(void);
233 @function SOSCCRequestToJoinCircle
234 @abstract Requests that this device join the circle.
235 @param error What went wrong if we tried to join.
236 @result true if we pushed the request out successfully. False if there was an error.
237 @discussion Requests to join the user's circle or all the pending circles (other than his) if there are multiple pending circles.
239 bool SOSCCRequestToJoinCircle(CFErrorRef
* error
);
242 @function SOSCCRequestToJoinCircleAfterRestore
243 @abstract Requests that this device join the circle and do the magic just after restore approval.
244 @param error What went wrong if we tried to join.
245 @result true if we joined or pushed a request out. False if we failed to try.
246 @discussion Uses the cloud identity to get in the circle if it can. If it cannot it falls back on simple application.
248 bool SOSCCRequestToJoinCircleAfterRestore(CFErrorRef
* error
);
251 @function SOSCCRequestEnsureFreshParameters
252 @abstract function to help debug problems with EnsureFreshParameters
253 @param error What went wrong if we tried to refresh parameters
254 @result true if we successfully retrieved fresh parameters. False if we failed.
256 bool SOSCCRequestEnsureFreshParameters(CFErrorRef
* error
);
259 @function SOSCCAccountSetToNew
260 @abstract reset account to new
261 @param error What went wrong if we tried to refresh parameters
262 @result true if we successfully reset the account object
264 bool SOSCCAccountSetToNew(CFErrorRef
*error
);
267 @function SOSCCResetToOffering
268 @abstract Resets the cloud to offer this device's circle.
269 @param error What went wrong if we tried to post our circle.
270 @result true if we posted the circle successfully. False if there was an error.
272 bool SOSCCResetToOffering(CFErrorRef
* error
);
275 @function SOSCCResetToEmpty
276 @abstract Resets the cloud to a completely empty circle.
277 @param error What went wrong if we tried to post our circle.
278 @result true if we posted the circle successfully. False if there was an error.
280 bool SOSCCResetToEmpty(CFErrorRef
* error
);
283 @function SOSCCRemoveThisDeviceFromCircle
284 @abstract Removes the current device from the circle.
285 @param error What went wrong trying to remove ourselves.
286 @result true if we posted the removal. False if there was an error.
287 @discussion This removes us from the circle.
289 bool SOSCCRemoveThisDeviceFromCircle(CFErrorRef
* error
);
292 @function SOSCCRemoveThisDeviceFromCircle
293 @abstract Removes a list of peers from the circle.
294 @param peerList List of peers to ensure aren't in the circle
295 @param error What went wrong trying to remove the peers.
296 @result true if we posted a circle with none of the peers listed as members, false if we had an error.
297 @discussion This removes peers in the list from the circle. One likely error is
298 that we don't have the user credentail (need to prompt for password)
300 bool SOSCCRemovePeersFromCircle(CFArrayRef peerList
, CFErrorRef
* error
);
303 @function SOSCCRemoveThisDeviceFromCircle
304 @abstract Removes the current device from the circle.
305 @param error What went wrong trying to remove ourselves.
306 @result true if we posted the removal. False if there was an error.
307 @discussion This removes us from the circle.
309 bool SOSCCLoggedOutOfAccount(CFErrorRef
* error
);
312 @function SOSCCBailFromCircle_BestEffort
313 @abstract Attempts to publish a retirement ticket for the current device.
314 @param error What went wrong trying to remove ourselves.
315 @result true if we posted the ticket. False if there was an error.
316 @discussion This attempts to post a retirement ticket that should
317 result in other devices removing this device from the circle. It does so
318 with a 5 second timeout. The only use for this call is when doing a device
321 bool SOSCCBailFromCircle_BestEffort(uint64_t limit_in_seconds
, CFErrorRef
* error
);
324 @function SOSCCSignedOut
325 @abstract Attempts to publish a retirement ticket for the current device.
326 @param immediate If we should remove the device immediately or to leave the circle with best effort.
327 @param error What went wrong trying to remove ourselves.
328 @result true if we posted the ticket. False if there was an error.
329 @discussion This attempts to post a retirement ticket that should
330 result in other devices removing this device from the circle. It does so
331 with a 5 second timeout or immediately.
333 bool SOSCCSignedOut(bool immediate
, CFErrorRef
* error
);
336 @function SOSCCCopyApplicantPeerInfo
337 @abstract Get the list of peers wishing admittance.
338 @param error What went wrong.
339 @result Array of PeerInfos for applying peers.
341 CFArrayRef
SOSCCCopyApplicantPeerInfo(CFErrorRef
* error
);
344 @function SOSCCCopyGenerationPeerInfo
345 @abstract Get the list of generation count per circle.
346 @param error What went wrong.
347 @result Array of Circle generation counts.
349 CFArrayRef
SOSCCCopyGenerationPeerInfo(CFErrorRef
* error
);
352 @function SOSCCCopyValidPeerPeerInfo
353 @abstract Get the list of valid peers.
354 @param error What went wrong.
355 @result Array of PeerInfos for applying valid peers.
357 CFArrayRef
SOSCCCopyValidPeerPeerInfo(CFErrorRef
* error
);
360 @function SOSCCValidateUserPublic
361 @abstract Validate whether the account's user public key is trustworthy.
362 @param error What went wrong.
363 @result true if the user public key is trusted, false if not.
365 bool SOSCCValidateUserPublic(CFErrorRef
*error
);
368 @function SOSCCCopyNotValidPeerPeerInfo
369 @abstract Get the list of not valid peers.
370 @param error What went wrong.
371 @result Array of PeerInfos for non-valid peers.
373 CFArrayRef
SOSCCCopyNotValidPeerPeerInfo(CFErrorRef
* error
);
376 @function SOSCCCopyRetirementPeerInfo
377 @abstract Get the list of retired peers.
378 @param error What went wrong.
379 @result Array of PeerInfos for retired peers.
381 CFArrayRef
SOSCCCopyRetirementPeerInfo(CFErrorRef
* error
);
384 @function SOSCCCopyViewUnawarePeerInfo
385 @abstract Copies all the peers who are in the circle but are unable to handle views.
386 @param error What went wrong.
387 @result Array of peer infos.
389 CFArrayRef
SOSCCCopyViewUnawarePeerInfo(CFErrorRef
* error
);
392 * Keys to find data in engine state dictionary
394 extern CFStringRef kSOSCCEngineStatePeerIDKey
;
395 extern CFStringRef kSOSCCEngineStateManifestCountKey
;
396 extern CFStringRef kSOSCCEngineStateSyncSetKey
;
397 extern CFStringRef kSOSCCEngineStateCoderKey
;
398 extern CFStringRef kSOSCCEngineStateManifestHashKey
;
401 @function SOSCCForEachEngineStateAsString
402 @abstract Get a string for each peer to dump to your favorite location.
403 @param error What went wrong.
404 @result if we had an error.
406 bool SOSCCForEachEngineStateAsString(CFErrorRef
* error
, void (^block
)(CFStringRef oneStateString
));
409 @function SOSCCAcceptApplicants
410 @abstract Accepts the applicants into the circle (requires that we recently had the user enter the credentials).
411 @param applicants List of applicants to accept.
412 @param error What went wrong if we tried to post our circle.
413 @result true if we accepted the applicants. False if there was an error.
415 bool SOSCCAcceptApplicants(CFArrayRef applicants
, CFErrorRef
* error
);
418 @function SOSCCRejectApplicants
419 @abstract Rejects the applications for admission (requires that we recently had the user enter the credentials).
420 @param applicants List of applicants to reject.
421 @param error What went wrong if we tried to post our circle.
422 @result true if we rejected the applicants. False if there was an error.
424 bool SOSCCRejectApplicants(CFArrayRef applicants
, CFErrorRef
*error
);
427 @function SOSCCCopyPeerPeerInfo
428 @abstract Returns peers in the circle (we may not be in it).
429 @param error What went wrong trying look at the circle.
430 @result Returns a list of peers in the circle currently syncing.
431 @discussion We get the list of all peers syncing in the circle.
433 CFArrayRef
SOSCCCopyPeerPeerInfo(CFErrorRef
* error
);
436 @function SOSCCSetAutoAcceptInfo
437 @abstract Arms auto-acceptance for the HSA2 data given.
438 @param error What went wrong.
439 @result true if the operation succeeded, otherwise false.
441 bool SOSCCSetAutoAcceptInfo(CFDataRef autoaccept
, CFErrorRef
*error
);
444 @function SOSCCCheckPeerAvailability
445 @abstract Prompts KeychainSyncingOverIDSProxy to query all devices in the circle with the same view.
446 @param error What went wrong.
447 @result true if the operation succeeded, otherwise false.
449 bool SOSCCCheckPeerAvailability(CFErrorRef
*error
);
452 * Return values for SOSCCGetLastDepartureReason
454 enum DepartureReason
{
455 kSOSDepartureReasonError
= 0,
456 kSOSNeverLeftCircle
, // We haven't ever left a circle
457 kSOSWithdrewMembership
, // SOSCCRemoveThisDeviceFromCircle
458 kSOSMembershipRevoked
, // Via reset or remote removal.
459 kSOSLeftUntrustedCircle
, // We saw a circle we could no longer trust
460 kSOSNeverAppliedToCircle
, // We've never applied to a circle
461 kSOSDiscoveredRetirement
, // We discovered that we were retired.
462 kSOSLostPrivateKey
, // We lost our private key
463 kSOSPasswordChanged
, // We lost our public key, password change?
464 // <-- add additional departure reason codes HERE!
465 kSOSNumDepartureReasons
, // ACHTUNG: this *MUST* be the last entry - ALWAYS!
469 @function SOSCCGetLastDepartureReason
470 @abstract Returns the code of why you left the circle.
471 @param error What went wrong if we returned kSOSDepartureReasonError.
473 enum DepartureReason
SOSCCGetLastDepartureReason(CFErrorRef
*error
);
476 @function SOSCCSetLastDepartureReason
477 @abstract Manually set the code of why the circle was left.
478 @param reason Custom departure reason be be set.
479 @param error What went wrong if we returned false.
482 bool SOSCCSetLastDepartureReason(enum DepartureReason reason
, CFErrorRef
*error
);
485 @function SOSCCGetIncompatibilityInfo
486 @abstract Returns the information (string, hopefully URL) that will lead to an explanation of why you have an incompatible circle.
487 @param error What went wrong if we returned NULL.
489 CFStringRef
SOSCCCopyIncompatibilityInfo(CFErrorRef
*error
);
495 Initial View List - To be expanded
497 For now for any peer joining a circle we only enable:
502 // -- Views that sync to os in (iOS in (7.1, 8.*) Mac OS in (10.9, 10.10)) peers
505 // kSOSViewKeychainV0 - All items in the original iCloud Keychain are in the views listed below
506 // It is defined by the query:
507 // class in (genp inet keys) and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and tkid = NULL
509 // kSOSViewWiFi - class = genp and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = apple and svce = AirPort
510 extern const CFStringRef kSOSViewWiFi
;
512 // kSOSViewAutofillPasswords - class = inet and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = com.apple.cfnetwork
513 extern const CFStringRef kSOSViewAutofillPasswords
;
515 // kSOSViewSafariCreditCards - class = genp and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = com.apple.safari.credit-cards
516 extern const CFStringRef kSOSViewSafariCreditCards
;
518 // kSOSViewiCloudIdentity - class = keys and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = com.apple.security.sos
519 extern const CFStringRef kSOSViewiCloudIdentity
;
520 // End of KeychainV0 views
522 // kSOSViewBackupBagV0 - class = genp and and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = com.apple.sbd
523 // (LEAVE OUT FOR NOW) and svce = SecureBackupService pdmn = ak acct = SecureBackupPublicKeybag
524 extern const CFStringRef kSOSViewBackupBagV0
;
526 // kSOSViewOtherSyncable - An or of the following 5 queries:
527 // class = cert and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL
528 // class = genp and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp = "apple" and svce != "AirPort"
529 // class = genp and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp not in ("apple", "com.apple.safari.credit-cards", "com.apple.sbd")
530 // class = inet and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp not in ("com.apple.cfnetwork")
531 // class = keys and pdmn in (ak,ck,dk,aku,cku,dku) and vwht = NULL and agrp not in ("com.apple.security.sos")
532 extern const CFStringRef kSOSViewOtherSyncable
;
535 // Views below this line all match a kSecAttrSyncViewHint attribute value that matches their name.
538 // PCS (Protected Cloud Storage) Views
539 extern const CFStringRef kSOSViewPCSMasterKey
;
540 extern const CFStringRef kSOSViewPCSiCloudDrive
;
541 extern const CFStringRef kSOSViewPCSPhotos
;
542 extern const CFStringRef kSOSViewPCSCloudKit
;
543 extern const CFStringRef kSOSViewPCSEscrow
;
544 extern const CFStringRef kSOSViewPCSFDE
;
545 extern const CFStringRef kSOSViewPCSMailDrop
;
546 extern const CFStringRef kSOSViewPCSiCloudBackup
;
547 extern const CFStringRef kSOSViewPCSNotes
;
548 extern const CFStringRef kSOSViewPCSiMessage
;
549 extern const CFStringRef kSOSViewPCSFeldspar
;
550 extern const CFStringRef kSOSViewPCSSharing
;
552 extern const CFStringRef kSOSViewAppleTV
;
553 extern const CFStringRef kSOSViewHomeKit
;
554 extern const CFStringRef kSOSViewContinuityUnlock
;
555 extern const CFStringRef kSOSViewAccessoryPairing
;
559 @abstract Enable, disable or query status of a View for this peer.
560 @param view The View for which the action should be performed.
561 @param action The action code to take with the View
562 @param error More description of the error if one occurred.
564 For all actions any error return can fallback to kSOSCCGeneralViewError. This is a catch-all until
565 more code is written and specific additional error returns are identified.
566 For kSOSCCViewEnable actions other possible return codes are:
567 kSOSCCViewMember if the operation was successful and the peer has access to the View
568 kSOSCCViewNotMember if the operation was a successful application to a View, yet the peer must be vetted by another peer.
569 kSOSCCViewNotQualified if the device can't support prerequisite security capabilities
570 kSOSCCNoSuchView if the CFStringRef doesn't match one of the known Views
572 For kSOSCCViewDisable actions other possible return codes are:
573 kSOSCCViewNotMember for successfully disabling the View
574 kSOSCCNoSuchView if the CFStringRef doesn't match one of the known Views
576 For kSOSCCViewQuery actions other possible return codes are:
577 kSOSCCViewMember or kSOSCCDSNotMember for successful querying of the status for a View for this peer
578 kSOSCCNoSuchView if the CFStringRef doesn't match one of the known Views
582 SOSViewResultCode
SOSCCView(CFStringRef view
, SOSViewActionCode action
, CFErrorRef
*error
);
586 @function SOSCCViewSet
587 @abstract Enable, disable or query status of a views for this peer.
588 @param enabledviews The views (as CFSet) for which the action should be performed.
589 @param disabledviews TODO
591 This call enables bulk setting of views for a peer. This is done for convenience as well as
592 better performance; it requires less circle changes by grouping all the view enabling/disabling.
594 Separate calls to SOSCCView is required to determine resulting view settings.
597 bool SOSCCViewSet(CFSetRef enabledviews
, CFSetRef disabledviews
);
600 Security Attributes for PeerInfos
602 Initial View List - To be expanded
605 extern const CFStringRef kSOSSecPropertyHasEntropy
;
606 extern const CFStringRef kSOSSecPropertyScreenLock
;
607 extern const CFStringRef kSOSSecPropertySEP
;
608 extern const CFStringRef kSOSSecPropertyIOS
;
612 @function SOSCCSecurityProperty
613 @abstract Enable, disable or query status of a SecurityProperty for this peer.
614 @param property The SecurityProperty for which the action should be performed.
615 @param action The action code to take with the SecurityProperty
616 @param error More description of the error if one occurred.
618 For all actions any error return can fallback to kSOSCCGeneralSecurityPropertyError.
619 For kSOSCCSecurityPropertyEnable actions other possible return codes are:
620 kSOSCCSecurityPropertyValid if the operation was successful and the peer's SecurityProperty is valid
621 kSOSCCSecurityPropertyNotValid if the operation was unsuccessful
622 kSOSCCSecurityPropertyNotQualified if the device can't support prerequisite security capabilities
623 kSOSCCNoSuchSecurityProperty if the CFStringRef doesn't match one of the known SecurityProperties
625 For kSOSCCSecurityPropertyDisable actions other possible return codes are:
626 kSOSCCSecurityPropertyNotMember for successfully disabling the SecurityProperty
627 kSOSCCNoSuchSecurityProperty if the CFStringRef doesn't match one of the known SecurityProperties
629 For kSOSCCSecurityPropertyQuery actions other possible return codes are:
630 kSOSCCSecurityPropertyValid or kSOSCCDSNotValidMember for successful querying of the status for a SecurityProperty for this peer
631 kSOSCCNoSuchSecurityProperty if the CFStringRef doesn't match one of the known SecurityProperties
635 SOSSecurityPropertyResultCode
SOSCCSecurityProperty(CFStringRef property
, SOSSecurityPropertyActionCode action
, CFErrorRef
*error
);
642 @function SOSCCCopyMyPeerWithNewDeviceRecoverySecret
643 @abstract Returns retained peer info for this device
644 @param secret user provided entropy
645 @param error What went wrong trying to register the new secret
646 @result Returns our peer info.
647 @discussion For miCSCs this creates a new wrapping of the view master key in the view bag protected by the secret.
649 SOSPeerInfoRef
SOSCCCopyMyPeerWithNewDeviceRecoverySecret(CFDataRef secret
, CFErrorRef
*error
);
652 @function SOSCCRegisterSingleRecoverySecret
654 @param error What went wrong trying to register the new secret
655 @result true if we saved the bag, false if we had an error
656 @discussion Asserts the keybag for use for backups when having a single secret. All views get backed up with this single bag.
658 bool SOSCCRegisterSingleRecoverySecret(CFDataRef aks_bag
, bool forV0Only
, CFErrorRef
*error
);
662 @function SOSCCIsThisDeviceLastBackup
663 @param error Why this query can't be accepted.
664 @result true if this is the last backup device, false otherwise.
667 bool SOSCCIsThisDeviceLastBackup(CFErrorRef
*error
);
670 @function SOSCCSetEscrowRecord
671 @param escrow_label Account label
672 @param tries Number of attempts
673 @param error What went wrong trying to set the escrow label
674 @result true if we saved the escrow record, false if we had an error
675 @discussion persist escrow records in the account object or the peer info
677 bool SOSCCSetEscrowRecord(CFStringRef escrow_label
, uint64_t tries
, CFErrorRef
*error
);
680 @function SOSCCCopyEscrowRecord
681 @param error What went wrong trying to set the escrow label
682 @result dictionary of the escrow record, false if we had an error, dictionary will be of format: [account label: <dictionary>], dictionary will contain (ex): "Burned Recovery Attempt Attestation Date" = "[2015-08-19 15:21]";
683 "Burned Recovery Attempt Count" = 8;
684 @discussion for debugging - retrieve the escrow record
686 CFDictionaryRef
SOSCCCopyEscrowRecord(CFErrorRef
*error
);
689 @function SOSCCCopyApplication
690 @param error What went wrong getting the applicant peerInfo.
691 @result PeerInfoRef that's an applicant peerinfo to be used as the start of an HSA2 piggyback entry.
694 SOSPeerInfoRef
SOSCCCopyApplication(CFErrorRef
*error
);
697 @function SOSCCCopyCircleJoiningBlob
698 @param applicant The peerInfo applicant to pre-approve for membership in the circle
699 @param error Why this peerInfo wasn't accepted.
700 @result DER blob containing the gencount and this peerkey signature of the current circle with the applicant as a member at the gencount.
702 CFDataRef
SOSCCCopyCircleJoiningBlob(SOSPeerInfoRef applicant
, CFErrorRef
*error
);
705 @function SOSCCJoinWithCircleJoiningBlob
706 @param joiningBlob DER blob to be used to create a suitable circle for this pre-approved peer to join.
707 @param error Why this peerInfo can't be accepted.
708 @result true if this succeeded.
711 bool SOSCCJoinWithCircleJoiningBlob(CFDataRef joiningBlob
, CFErrorRef
*error
);
714 @function: bool SOSCCPeersHaveViewsEnabled(CFSetRef viewNames)
715 @param viewNames the collection of views we want to know if other peers have enabled
716 @result CFBooleanTrue if we are in circle and all views are enabled by at least one other peer,
717 CFBooleanFalse if we are in circle and any of the views aren't avaialbe
718 NULL if we have an error.
720 CFBooleanRef
SOSCCPeersHaveViewsEnabled(CFArrayRef viewNames
, CFErrorRef
*error
);
723 @function: bool SOSCCRegisterRecoveryPublicKey(CFDataRef recovery_key, CFErrorRef *error);
724 @param recovery_key the cf data representation of the recovery public key
725 Can be passed in as NULL to indicate the CFDataRef should be removed from the keychain
726 @result CFBooleanTrue if the public key was successfully stored in the syncable keychain
727 CFBooleanFalse if securityd could not store the recovery key (locked?)
728 NULL if we have an error.
730 bool SOSCCRegisterRecoveryPublicKey(CFDataRef recovery_key
, CFErrorRef
*error
);
733 @function: bool SOSCCMessageFromPeerIsPending(SOSPeerInfoRef peer, CFErrorRef *error)
734 @param peer PeerInfo for the peer to ask about
735 @param error failure if we fail
736 @reulst true if we have a message pending that we haven't processed, false if we don't have one queued right now or an error occurred.
738 bool SOSCCMessageFromPeerIsPending(SOSPeerInfoRef peer
, CFErrorRef
*error
);
741 @function: bool SOSCCSendToPeerIsPending(SOSPeerInfoRef peer, CFErrorRef *error)
742 @param peer PeerInfo for the peer to ask about
743 @param error failure if we fail
744 @reulst true if we have an attempt to sync pending that we haven't processed, false if we don't have one queued right now or an error occurred.
746 bool SOSCCSendToPeerIsPending(SOSPeerInfoRef peer
, CFErrorRef
*error
);