Function

SecKeychainItemDelete(_:)

Deletes a keychain item from the default keychain’s permanent data store.

Declaration

func SecKeychainItemDelete(_ itemRef: SecKeychainItem) -> OSStatus

Parameters

itemRef

A keychain item object of the item to delete. You must call the CFRelease function to release this object when you are finished using it.

Return Value

Discussion

If the keychain item has not previously been added to the keychain, this function does nothing and returns noErr.

Do not delete a keychain item and recreate it in order to modify it; instead, use the SecKeychainItemModifyContent(_:_:_:_:) or SecKeychainItemModifyAttributesAndData(_:_:_:_:) function to modify an existing keychain item. When you delete a keychain item, you lose any access controls and trust settings added by the user or by other applications.

See Also

Legacy Keychain Item Management

func SecKeychainItemFreeAttributesAndData(UnsafeMutablePointer<SecKeychainAttributeList>?, UnsafeMutableRawPointer?) -> OSStatus

Releases the memory used by the keychain attribute list and/or the keychain data retrieved in a call to SecKeychainItemCopyAttributesAndData.

func SecKeychainItemFreeContent(UnsafeMutablePointer<SecKeychainAttributeList>?, UnsafeMutableRawPointer?) -> OSStatus

Releases the memory used by the keychain attribute list and the keychain data retrieved in a call to the SecKeychainItemCopyContent(_:_:_:_:_:) function.

typealias SecKeychainAttrType

The keychain attribute type.

struct SecKeychainAttribute

A structure that holds a single keychain attribute.

typealias SecKeychainAttributePtr

A pointer to a keychain attribute structure.

struct SecKeychainAttributeList

A list of keychain attributes.