Raw private/public key usage

Hi,


I have a public/private key pair in raw format. e.g. all I have is the big integers, but no format. I am looking for a way to implement those keys into iOS 10 with Swift 3. Can someone point me in the right direction


Thanks, I appreciate that.


Best,

Rudy

Replies

Presumably you’re talking about an RSA key. If so, you’ll have to massage those big integers into PKCS#1 format, at which point you can import the key using

SecKeyCreateWithData
. iOS does not provide any infrastructure for doing this massage, so you can either:
  • Write or acquire your own general-purpose ASN.1 library, and have that do the massage for you

  • Write some small special-purpose ASN.1 code for this

Or, better yet, change the source of this key — which presumably has a full-featured crypto toolbox — to send you PKCS#1 data.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"