¡@

Home 

2014/10/15 ¤U¤È 10:09:34

iphone Programming Glossary: getpublickeyref

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

uint8_t cipherBuffer void decryptWithPrivateKey uint8_t cipherBuffer plainBuffer uint8_t plainBuffer SecKeyRef getPublicKeyRef SecKeyRef getPrivateKeyRef void testAsymmetricEncryptionAndDecryption void generateKeyPair NSUInteger keySize @end ViewController.m.. static const UInt8 privateKeyIdentifier com.apple.sample.privatekey @implementation ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary.. plainBuffer size_t cipherBufferSize CIPHER_BUFFER_SIZE NSLog @ SecKeyGetBlockSize public lu SecKeyGetBlockSize self getPublicKeyRef Error handling Encrypt using the public. status SecKeyEncrypt self getPublicKeyRef PADDING plainBuffer plainBufferSize..

RSA implementations in Objective C

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

uint8_t cipherBuffer void decryptWithPrivateKey uint8_t cipherBuffer plainBuffer uint8_t plainBuffer SecKeyRef getPublicKeyRef SecKeyRef getPrivateKeyRef void testAsymmetricEncryptionAndDecryption void generateKeyPair NSUInteger keySize @end ViewController.m.. static const UInt8 privateKeyIdentifier com.apple.sample.privatekey @implementation ViewController SecKeyRef getPublicKeyRef OSStatus sanityCheck noErr SecKeyRef publicKeyReference NULL if publicKeyReference NULL self generateKeyPair 512 NSMutableDictionary.. plainBuffer size_t cipherBufferSize CIPHER_BUFFER_SIZE NSLog @ SecKeyGetBlockSize public lu SecKeyGetBlockSize self getPublicKeyRef Error handling Encrypt using the public. status SecKeyEncrypt self getPublicKeyRef PADDING plainBuffer plainBufferSize..