SecItemAdd returns errSecAuthFailed

Hello,

I'm experiencing a weird issue on the iOS 15 simulator (unfortunately I don't have a device with 15 installed yet).

The issue I see is that the call to SecItemAdd returns OSStatus -25293 (errSecAuthFailed).

The attributes dictionary passed looks like this:

var query: [String : Any] = [
			kSecClass as String: kSecClassGenericPassword,
			kSecAttrAccount as String: key,
			kSecAttrService as String: service,
			kSecAttrAccessControl as String: getSecAccessControl(),
			kSecUseAuthenticationContext as String: context,
			kSecValueData as String: data
        ]

the getSecAccessControl returns a SecAccessControl created like this:

        access = SecAccessControlCreateWithFlags(nil,
			  kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
			  .userPresence,
			  &error)

if I do not add the kSecAttrAccessControl item I don't see any error.

The same code works as expected on the simulator with iOS 14. Looking at the documentation didn't help, anybody has hints about this? Maybe it's bug I'm not aware of?

Thank you in advance

if I do not add the kSecAttrAccessControl item I don't see any error. Looking at the documentation didn't help, anybody has hints about this? Maybe it's bug I'm not aware of?

If removing kSecAttrAccessControl from the attributes dictionary results in this functionality working correctly then I would absolutely get a bug down for this. As a side note, I seen a related issue recently when adding access control attributes to a Keychain API for item creation, so this will need to get investigated during the beta cycle to see if there is a potential issue here.

Create a bug report here, and please respond back with the Feedback ID. Also, if you have time, please record the output of what is being stored in your attribute dictionary before SecItemAdd is called with lldb. Take this information and compare it against the local variables on your breakpoint and if your access control items print "(no summary)" then please make sure to add both the local variables and lldb info to the bug report.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Hello Matt, thanks for your reply.

I've submitted a bug report, FeedBack ID: FB9414546

I've submitted a bug report, FeedBack ID: FB9414546

Thank you for submitting a bug report here. I see it internally.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Hello,

Same issue for me on ios 15 simultor. Any new elements in the bug report ?

Ditto. Code that works fine on iOS 12, 13, 14 and 15 (devices) fails on iOS 15 simulator.

SecItemAdd returning errSecAuthFailed. kSecAttrAccessControl object has kSecAccessControlBiometryCurrentSet|kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly

I am also seeing this issue on the iOS 15 simulator. I can't view the bug report on the Feedback ID link posted above. What is the status?

Hi Matt Do you have any updates on this? It's a real show stopper for us if you could please provide some guidance. Thanks

Same issue here. It's a relief to read I'm not the only person having this exact issue.

There have been several reports here of testing this on the iOS simulator. While the simulator works well is most cases, it's not an exact representation of what with happen on a physical iOS device, especially with Biometric Authentication. So the first step is that I would always test this on a physical device when possible.

Next, regarding:

SecItemAdd returning errSecAuthFailed. kSecAttrAccessControl object has kSecAccessControlBiometryCurrentSet|kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly

This is a known issue right now and is being tracked against (r. 82890873). There is no update on when this will make it to a release, so the only thing that I can advise at this point is to create a bug report if you have not already and then please keep testing the iOS beta's as they are rolled out.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

I have the same problem on iOS simulator. XCode 13, iOS 15, MacOS Monterey, Mac with M1 processor.

Any updates?

Tested with Xcode 13.2 beta (13C5066c), iOS 15.2 simulator and still fails with same error. I'm on macOS Big Sur 11.6.1 (Intel).

Looks like it is happening even with the coding examples from Apple: https://developer.apple.com/documentation/localauthentication/accessing_keychain_items_with_face_id_or_touch_id

Did someone check it is happening when testing on the latest iPhone 13 devices with iOS 15 building from Xcode 13?

I just checked on iPhone 13 Pro with iOS 15.0, and I can confirm that the error does not exist. On the simulator, we still experience the issue.

We're experiencing this issue as well, opened a bug report: FB9777739.

Any updates?

SecItemAdd returns errSecAuthFailed
 
 
Q