Retrieves the default keychain from a specified preference domain.


func SecKeychainCopyDomainDefault(_ domain: SecPreferencesDomain, _ keychain: UnsafeMutablePointer<SecKeychain?>) -> OSStatus



The preference domain from which you wish to retrieve the default keychain. See SecPreferencesDomain for possible domain values.


On return, a pointer to the keychain object of the default keychain in the specified preference domain.

Return Value


A preference domain is a set of security-related preferences, such as the default keychain and the current keychain search list. Use this function if you want to retrieve the default keychain for a specific preference domain. Use the SecKeychainCopyDefault(_:) function if you want the default keychain for the current preference domain. See the SecKeychainSetPreferenceDomain(_:) function for a discussion of current and default preference domains.

See Also

Preference Domains

func SecKeychainSetDomainDefault(SecPreferencesDomain, SecKeychain?) -> OSStatus

Sets the default keychain for a specified preference domain.

func SecKeychainCopyDomainSearchList(SecPreferencesDomain, UnsafeMutablePointer<CFArray?>) -> OSStatus

Retrieves the keychain search list for a specified preference domain.

func SecKeychainSetDomainSearchList(SecPreferencesDomain, CFArray) -> OSStatus

Sets the keychain search list for a specified preference domain.

enum SecPreferencesDomain

The keychain preference domains.