title: MacOS: SecKeyCreateWithData fails with code 50
body: <p>I've got the following Swift code below:</p>
  
  <pre><code>    let privString = "MHQCAQEEIEuXPCziDSJqCxpOHEhcg1sEm7EtEiH2XVvXK69DcUHroAcGBSuBBAAKoUQDQgAECDDYmcIpUxC2EVJu8o/qPHPoZMId11A/2nVAXJByFOYSigUnZ6njK4qZQMGxLr3xNND17yYoXZ21QKus4bUHfg=="
  
      let privData = NSData(base64Encoded: privString)
      let privRaw = privData?.bytes.assumingMemoryBound(to: UInt8.self)
      let CFPrivData = CFDataCreate(nil, privRaw!, privData!.length)
  
      let options: [String: Any] = [kSecAttrKeyType as String: kSecAttrKeyTypeECDSA,
                                    kSecAttrKeyClass as String: kSecAttrKeyClassPrivate,
                                    kSecAttrKeySizeInBits as String: 256]
      var error: Unmanaged&lt;CFError&gt;?
  
      guard let privKey = SecKeyCreateWithData(CFPrivData!, options as CFDictionary, &amp;error) else {
          throw error!.takeRetainedValue() as Error
      }
  </code></pre>
  
  <p>The key is a PEM file with the headers stripped and the private key was generated with the following command</p>
  
  <pre><code>openssl ecparam -genkey -name secp256k1 -noout -out ngthnd_priv.pem
  </code></pre>