views:

77

answers:

1

Hello Community

I am trying to get the public and private Key from a certificate which i have already installed on the iPhone. (It is shown unter Settings -> General -> Profiles)

I need this keys for encryption sensitive data. (RSA Algorithm)

Up to now i have found no way to get access to the keys. Is it even possible ?

If not: What is the best possible way to realize my problem otherwise ?

Thank you for all helpful answers.

A: 

1.) You can't get the private key of the profile for the simple reason, that your private key is not stored in the profile, it is only signed with it.

Instead consider getting familiar with the Security.framework. This post should give you a start

thatsdisgusting
thx for your answer. The encryption and decryption with generated Keys on the iPhone is implemented and works correct. When the import of a certificate is not possible, is there a way to import a private and public keypair otherwise ?
Raphael
Hi, your welcome. Actually, i dont get to 100% what you want. You would never import a private key from somewhere you would rather generate one (I hope i dont misunderstand). I guess you need an algorithm for key exchange with whatever server you get the encrypted data from (or to send it to). One possibility would be implementing a Diffie-Hellman key exchange. There are some nice implementations doing this. One is crypto++, an iPhone Port exists, you can get it there: http://www.ugosweb.com/cryptopp.aspx
thatsdisgusting