@alberti82 That's right. The error indicates that the keychain has not been unlocked. For iOS devices, this means the phone is locked. In those cases, the decryption cannot happen because the device's keys are locked away to protect them from attacks.
On iOS devices, you can store your keychain item with less security if you need the value to be available in an unlocked state. However, that vastly reduces the security you'll get out of the Keychain, so consider your usecase.
To store your keys on iOS with less security (this may work for macOS as well, idk), you can use:
kSecAttrAccessibleAfterFirstUnlock (https://developer.apple.com/documentation/security/ksecattraccessiblealways)
This means the value is not available upon boot-up, but once unlocked once, it'll subsequently be available. This provides the minimum amount of protection you should be using.
Topic:
Privacy & Security
SubTopic:
General
Tags: