I'm developing an application that uses the keychain to store login credentials. To access the keychain I'm using the UICKeyChainStore-library to make it easier.
When I'm running it on a device everything is working perfectly, credentials are stored and read from the keychain.
The application has to be MDM-wrapped and thats where the problem starts. As soon as it's wrapped I can't read or write from/to the keychain anymore whatsoever.
I tracked it down to a SecItemCopyMatching call, which checks if the value is already stored. In the unwrapped case I get the status-code -25300 = noItemFound back which is good, as the keychain is empty at start.
However with the exactly same parameters in the wrapped case the return-code is -50 which is the errSecParam error, telling me that the dictionary I put into the method is invalid.
I tried turning parameters on / off or leaving them away, nothing changes. Always -50 error-code.
Has anyone of you maybe had to deal with this kind of issue in the past? I'm really running out of ideas here.
The dictionary looks like this:
Like I said, when I don't wrap it, these parameters are perfectly fine and accepted.
Ok so it turns out that this actually was a bug from Citrix MDM. When wrapped, the method SecItemCopyMatching DOES NOT WORK. It just doesn't. As workaround we now use SecItemInsert and check if the return-code is "duplicateItem".