Re: SecKeyGeneratePair export Public Key and OpenSSL API
Re: SecKeyGeneratePair export Public Key and OpenSSL API
- Subject: Re: SecKeyGeneratePair export Public Key and OpenSSL API
- From: Nicko van Someren <email@hidden>
- Date: Thu, 6 Nov 2008 21:40:11 +0000
On 4 Nov 2008, at 15:59, Jacopo Mangiavacchi wrote:
I need to export a public key generated with the SecKeyGeneratePair
API and send it to a WebServices (written in PHP) that using the
OpenSSL API must encrypt something using this key and return back
the ciphered value to the cocoa client.
In order to pass the public key NSData buffer I've tried to encode
that in Base64 format and to pass it as a standard RSA pubkey string
because I know that OpenSSL can accept a string like that.
...
Am I missing something ?
The base64 encoded key block for OpenSSL needs to be a DER encoded
PKCS#1 public key block, not just the raw key bytes. Track down the
SecKeychainItemExport function (in SecImportExport.h) and call it with
the kSecFormatOpenSSL parameter to get the data you need, then base64
encode the result.
Cheers,
Nicko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden