3

The following code fails with OSStatus -50 (secParam) both in my manual code and in other libraries (SwiftyRSA, Heimdall) on XCode 9.0, ios 10+. Any ideas as to why or any way to obtain more info?

let keyDict: [CFString: Any] = [
        kSecAttrKeyType: kSecAttrKeyTypeRSA,
        kSecAttrKeyClass: kSecAttrKeyClassPublic,
        kSecAttrKeySizeInBits: NSNumber(value: 4096),
        kSecAttrIsSensitive: false,
        kSecAttrIsExtractable: true,
        kSecAttrCanEncrypt: true
    ]

    var errP: Unmanaged<CFError>?
    key = SecKeyCreateWithData(
        publicKeyData as CFData, keyDict as CFDictionary, &errP
    )
RedPoppy
  • 573
  • 4
  • 11
  • I assume you've already seen this [closed / fixed issue in SwiftyRSA's repo](https://github.com/TakeScoop/SwiftyRSA/issues/50)? What did you use to generate your 4096 bit key? – Michael Dautermann Sep 28 '17 at 12:12
  • No, I haven't seen that, it is interesting. But: 1) the code worked in xcode 8.3.3 2)it affects both SwiftyRSA and Heimdall as well as my handwritten CommonCrypto code 3) haven't changed anything related to secParams – RedPoppy Sep 29 '17 at 06:13

1 Answers1

0

Well, there have been an error creating keychain items with iOS10. And it was a problem in simulator, but worked on device.

As quick solution you had to enable keychain sharing. Original bug I reported was marked as Duplicate and it is closed now. Maybe regression in iOS11?

Juraj Antas
  • 3,059
  • 27
  • 37