PDA

View Full Version : How to store private key and distribute public key




forrestxu
Jul 20, 2008, 10:59 AM
Hi,

I need your help.

I am new to IPhone Programming. I produced rsa public key and private key using the code below:

NSMutableDictionary *myDictionary=[[NSMutableDictionary alloc] init];
[myDictionary setObject:(id)kSecAttrKeyTypeRSA forKey:(id)kSecAttrKeyType];
[myDictionary setObject:@"512" forKey:(id)kSecAttrKeySizeInBits];
SecKeyGeneratePair((CFDictionaryRef) myDictionary, &publicKey, &privateKey);

How do I store privateKey into iphone? save it as a file? how to distribute the publicKey. send it by a file?


Thank you in advance.

Forrest