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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to