download file from
http:/\iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html
and use them like this
NSString *passphrase = @"1234567812345678";
NSStringEncoding myEncoding = NSASCIIStringEncoding;
NSString *alphaStringPlain = @"hello";
NSData *alphaDataPlain = [alphaStringPlain dataUsingEncoding:myEncoding];
NSData *alphaDataCypher = [alphaDataPlain AESEncryptWithPassphrase:passphrase];
NSString *alphaStringCypher = [[NSString alloc] initWithData:alphaDataCypher encoding:myEncoding];
NSLog(alphaStringCypher); // encode
///////
NSData *zCypher = [alphaDataCypher AESDecryptWithPassphrase:passphrase];
NSString *Cypher = [[NSString alloc] initWithData:zCypher encoding:myEncoding];
//NSData *zCypher = [alphaStringCypher AESDecryptWithPassphrase:passphrase];
NSLog(@" hua kya decode %@",[Cypher dataUsingEncoding:NSUTF8StringEncoding]);// decode
deatil code
http:\/blog.objectgraph.com/index.php/2010/04/20/encrypting-decrypting-base64-encode-decode-in-iphone-objective-c/
No comments:
Post a Comment