Unlocks a keychain.
- macOS 10.2+
A reference to the keychain to unlock. Pass
NULLto specify the default keychain. If you pass a locked keychain, this function displays the Unlock Keychain dialog box if you have not provided a password. If the specified keychain is currently unlocked, the Unlock Keychain dialog box is not displayed and this function returns
no. You must call the
CFReleasefunction to release this object when you are finished using it.
An unsigned 32-bit integer representing the length of the password buffer.
A buffer containing the password for the keychain. Pass
NULLif the user password is unknown. In this case, this function displays the Unlock Keychain dialog to prompt the user for the keychain password.
A Boolean value indicating whether the password parameter is used. You should pass
TRUEif you are passing a password or
FALSEif it is to be ignored.
A result code. See Security Framework Result Codes. The result code
err indicates that the user pressed the Cancel button in the Unlock Keychain dialog box. The result code
err indicates that authentication failed because of too many unsuccessful retries. The result code
err indicates that user interaction is required to unlock the keychain.
In most cases, your application does not need to call this function directly, since most Keychain Services functions that require an unlocked keychain do so for you. If your application needs to verify that a keychain is unlocked, call the function