After restoring a backup SecItemCopyMatching returns -26276

  • KeychainTouchID application was installed using Xcode and executed. The key was generated by clicking " Add secure key ", and it was used by clicking " Use secure key ". The key was generated using Secure Enclave.
  • An encrypted backup of the iPhone on the computer was made using iTunes. All contents and settings deleted (Settings β†’ General β†’ Reset β†’ Erase all contents and settings).
  • An encrypted backup of the iPhone was restored to the same iPhone.
  • Reinstalling the KeychainTouchID application should be performed as it is installed using Xcode.
  • The KeychainTouchID application was run.
  • So after that:

When you click Use Secure Key, -26276 is returned (function AAPLKeychainTestsViewController.m @ 288 β†’ SecItemCopyMatching )

When you click Delete Secure Key, reutrns -4 (function AAPLKeychainTestsViewController.m @ 326 β†’ SecItemDelete )

When you click Add Secure Key, success is returned, but deletion and use are not possible.


I found here : errSecInternal = - 26276 , / * An internal error occurred in the security structure. * /

Therefore, in this case, I can’t access the newly added key.

  • Why, after restoring a backup, SecItemCopyMatching returns -26276?
  • Why is it impossible to remove, but can be added?
  • Does anyone have enough of this experience?
  • How to solve this problem?

I posted this issue for the Apple team, but there was no response for more than 1 month.

+5
source share
1 answer

I would retype the question on the security list. However, from my remote memory, these keys are most likely marked with ACLs that prevent them from getting a backup, so you are faced with the equivalent of a dangling pointer in the key chain. If you re-add an item with the appropriate name or something else, it replaces that item, and it should work from that point.

However, if deleting and using this fails after re-adding the item, something very strange happens, in which case I would give an error. They will probably ask you to set up a configuration profile that will allow you to crack debugging, reproduce the error, and send logs.

+1
source

Source: https://habr.com/ru/post/1243377/


All Articles