Keychain is a secure location in an iOS where data is encrypted and tied to the device locking/unlocking. The keychain database is in an encrypted format and the encryption happens with a unique hardware-specific key. The hardware key that is used for the encryption is at a secure location and can't be extracted from the device. Keychain items are classified into five classes, as follows:
Generic passwords (
kSecClassGenericPassword
)Internet passwords (
kSecClassInternetPassword
)Certificates (
kSecClassCertificate
)Keys (
kSecClassKey
)Digital identities (
kSecClassIdentity
, identity=certificate + key).
Data protection mechanism has been implemented by iOS, in which the keychain having sensitive data is protected with another layer of encryption and is tied to the user's passcode. Data protection mechanism is designed to protect the user's data in case a device is lost or stolen. So the encryption offered by the data protection API is dependent on the strength of the...