Generate an RSA key pair using OpenSSL compiled using ios-openssl and get an NSData representation of both the private and the public key. NSData+Base64 or any other base 64 encoding library can be used to encode the data so it can be persisted.