¡@

Home 

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

iphone Programming Glossary: publickeyreference

Iphone - How to encrypt NSData with public key and decrypt with private key?

http://stackoverflow.com/questions/10072124/iphone-how-to-encrypt-nsdata-with-public-key-and-decrypt-with-private-key

@implementation ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary queryPublicKey NSMutableDictionary alloc init.. ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary queryPublicKey NSMutableDictionary alloc init Set the public key query.. id kSecReturnRef Get the key. sanityCheck SecItemCopyMatching __bridge CFDictionaryRef queryPublicKey CFTypeRef publicKeyReference if sanityCheck noErr publicKeyReference NULL queryPublicKey release else publicKeyReference publicKey return publicKeyReference..

RSA implementations in Objective C

http://stackoverflow.com/questions/10222524/rsa-implementations-in-objective-c

@implementation ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary queryPublicKey NSMutableDictionary alloc init.. ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary queryPublicKey NSMutableDictionary alloc init Set the public key query.. id kSecReturnRef Get the key. sanityCheck SecItemCopyMatching __bridge CFDictionaryRef queryPublicKey CFTypeRef publicKeyReference if sanityCheck noErr publicKeyReference NULL queryPublicKey release else publicKeyReference publicKey return publicKeyReference..