This is still an ongoing problem. macOS 12.3 & Xcode 13.3 are fully up-to-date. Cleaned build folder and freshly integrated pods. Building will throw the same error.
We have tried all of the solutions short of locking the keychain (because apparently we cant do that anymore? the option is disabled) but alas, nothing has worked. Neither Login or local can be locked.
The only "solution" we have found to this problem is to restart the computer. Why? Great question! I don't know. I suspect its locking/unlocking the keychain which rectified whatever cert build error is occurring but its ridiculous to have to go to such lengths. Logging off of the user also does not help. It has to be a full reboot.