I write an iOS app to communicate with an existing server. The server generates RSA key pair(public key and private key), and sends public key to the client.
The cli
I will answer my qustion:
I am helped by this post: http://blog.flirble.org/2011/01/05/rsa-public-key-openssl-ios/#its-all-in-the-format
It led to my code: https://github.com/ideawu/Objective-C-RSA/blob/master/RSA.m#L34
Use Apple's SecKeyEncrypt
(https://developer.apple.com/library/ios/documentation/Security/Reference/certifkeytrustservices/index.html)
https://github.com/ideawu/Objective-C-RSA