I am storing a openssl private Key EVP_PKEY as nsdata. For this I am serializing into a byte stream using the code below
unsigned char *buf, *p; int len; len
A simple way to convert arbitrary NSData to NSString is to base64 encode it.
NSString *base64EncodedKey = [keydata base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength];
You can then store it into your database for reuse later. Just decode it back to NSData.