¡@

Home 

2014/10/15 ¤U¤È 10:13:00

iphone Programming Glossary: publickeybits

Extracting a public key from key pair in key chain

http://stackoverflow.com/questions/11467215/extracting-a-public-key-from-key-pair-in-key-chain

publicIdentifier NSData getPublicKeyBits NSString publicKeyIdentifier OSStatus sanityCheck noErr NSData publicKeyBits nil CFTypeRef pk NSMutableDictionary queryPublicKey NSMutableDictionary alloc init NSData publicTag publicKeyIdentifier.. key bits. sanityCheck SecItemCopyMatching __bridge_retained CFDictionaryRef queryPublicKey pk if sanityCheck noErr publicKeyBits nil publicKeyBits __bridge_transfer NSData pk NSLog @ public bits @ publicKeyBits return publicKeyBits Output the public.. SecItemCopyMatching __bridge_retained CFDictionaryRef queryPublicKey pk if sanityCheck noErr publicKeyBits nil publicKeyBits __bridge_transfer NSData pk NSLog @ public bits @ publicKeyBits return publicKeyBits Output the public bits part last line..

Saving SecKeyRef device generated public/private key pair on disk

http://stackoverflow.com/questions/5988735/saving-seckeyref-device-generated-public-private-key-pair-on-disk

get the bytes for a public key using SecItemCopyMatching . NSData getPublicKeyBits OSStatus sanityCheck noErr NSData publicKeyBits nil NSMutableDictionary queryPublicKey NSMutableDictionary alloc init Set the public key query dictionary. queryPublicKey.. forKey id kSecReturnData Get the key bits. sanityCheck SecItemCopyMatching CFDictionaryRef queryPublicKey CFTypeRef publicKeyBits if sanityCheck noErr publicKeyBits nil queryPublicKey release return publicKeyBits The above is from Apple's CryptoExercise... key bits. sanityCheck SecItemCopyMatching CFDictionaryRef queryPublicKey CFTypeRef publicKeyBits if sanityCheck noErr publicKeyBits nil queryPublicKey release return publicKeyBits The above is from Apple's CryptoExercise. Not sure if it works for private..