PCLCrypto: Problem Import Public Key in IOS 10
My App in Xamarin IOS there is this exception during ImportPublicKey:
Stack:
at PCLCrypto.RsaAsymmetricKeyAlgorithmProvider.ImportPublicKey (System.Byte[] keyBlob, PCLCrypto.CryptographicPublicKeyBlobType blobType) [0x000b4] in <0d3c0b2586f645d4a87ef50f78aa84f8>:0
Message: SecItemAdd return -34018
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (4 by maintainers)
I ran across this, too. Seems to be an Xcode issue at the root. Finally found a simple workaround with Xamarin tooling:
With that I was able to get @leastprivilege’s iOSClient sample running on iOS 10 simulator.
ref: https://bugzilla.xamarin.com/show_bug.cgi?id=44361#c3 for more about the Xcode problem, see https://forums.developer.apple.com/message/179846 and https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html (search the page for 28338972)
Just to supplement @gregfiske’s comment - I was getting the same exception, and the issue was appearing on iOS 10 Simulator.
System.InvalidOperationException: SecItemAdd return -34018 ... at PCLCrypto.RsaAsymmetricKeyAlgorithmProvider.ImportPublicKey
By adding entitlements to iOS Bundle Signing as @gregfiske recommended (yes, even for debug & release and for simulator), the issue was resolved. Just ensure you have corresponding signing identity and provisioning profile for your bundle ID.