¡@

Home 

2014/10/15 ¤U¤È 10:12:55

iphone Programming Glossary: privatetag

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

Security.h @interface ViewController UIViewController SecKeyRef publicKey SecKeyRef privateKey NSData publicTag NSData privateTag void encryptWithPublicKey uint8_t plainBuffer cipherBuffer uint8_t cipherBuffer void decryptWithPrivateKey uint8_t cipherBuffer.. text s plainBuffer SecKeyRef getPrivateKeyRef OSStatus resultCode noErr SecKeyRef privateKeyReference NULL NSData privateTag NSData dataWithBytes @ ABCD length strlen const char @ ABCD if privateKey NULL self generateKeyPair 512 NSMutableDictionary.. dictionary. queryPrivateKey setObject __bridge id kSecClassKey forKey __bridge id kSecClass queryPrivateKey setObject privateTag forKey __bridge id kSecAttrApplicationTag queryPrivateKey setObject __bridge id kSecAttrKeyTypeRSA forKey __bridge id kSecAttrKeyType..

RSA implementations in Objective C

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

Security.h @interface ViewController UIViewController SecKeyRef publicKey SecKeyRef privateKey NSData publicTag NSData privateTag void encryptWithPublicKey uint8_t plainBuffer cipherBuffer uint8_t cipherBuffer void decryptWithPrivateKey uint8_t cipherBuffer.. text s plainBuffer SecKeyRef getPrivateKeyRef OSStatus resultCode noErr SecKeyRef privateKeyReference NULL NSData privateTag NSData dataWithBytes @ ABCD length strlen const char @ ABCD if privateKey NULL self generateKeyPair 512 NSMutableDictionary.. dictionary. queryPrivateKey setObject __bridge id kSecClassKey forKey __bridge id kSecClass queryPrivateKey setObject privateTag forKey __bridge id kSecAttrApplicationTag queryPrivateKey setObject __bridge id kSecAttrKeyTypeRSA forKey __bridge id kSecAttrKeyType..

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

NSMutableDictionary alloc init NSData publicTag publicIdentifier dataUsingEncoding NSUTF8StringEncoding NSData privateTag privateIdentifier dataUsingEncoding NSUTF8StringEncoding SecKeyRef publicKey NULL SecKeyRef privateKey NULL keyPairAttr.. privateKeyAttr setObject NSNumber numberWithBool YES forKey __bridge id kSecAttrIsPermanent privateKeyAttr setObject privateTag forKey __bridge id kSecAttrApplicationTag publicKeyAttr setObject NSNumber numberWithBool YES forKey __bridge id kSecAttrIsPermanent..