Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

forrestxu

macrumors newbie
Original poster
May 31, 2008
16
0
Hi,

I need your help.

I am new to Mac Programming. I used new version iphone SDK beta 6.
I used the code below to produce keys that is used for encryption and decryption.

CFAllocatorRef allocator = NULL;
const void **keys = NULL;
const void **values= NULL;
CFIndex numValues = 0;
const CFDictionaryKeyCallBacks *keyCallBacks = NULL;
const CFDictionaryValueCallBacks *valueCallBacks = NULL;
SecKeyRef *publicKey;
SecKeyRef *privateKey;
CFDictionaryRef parameters = CFDictionaryCreate(allocator, keys, values, numValues, keyCallBacks, valueCallBacks);
OSStatus ret = SecKeyGeneratePair(parameters, publicKey, privateKey);

I used security framework /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/Frameworks/Security.framework
A header Headers/secKey.h is under above folder. But when I debug the code, I found the following code is included:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Security.framework/Versions/A/Headers/SecKey.h
It is not I expected. Because SecKeyGeneratePair does not defined in above header, it causes compile error.
Something wrong with me or it is a bug from sdk?

Next question, If SecKeyGeneratePair(parameters, publicKey, privateKey) is right function, how can I set up parameters so that i can produce different pair publicKey and privateKey in two calls.

Thank you in advance.

Forrest
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.