AES256 use XML file
hi friend i want save objNSData in my xml file and later i want read my data from file xml and decrypt and i want use this code ,haw i can convert NSMutableData to string and later convert NSString to NSMutableData
NSString *strData = @"Bonjour tout le m开发者_Python百科onde, je voudrais vous présenter la Société Futur";
NSLog(@"before encryption : %@",strData);
NSMutableData *objNSData = [NSMutableData dataWithData:[strData dataUsingEncoding:NSUTF16StringEncoding]];
objNSData = [objNSData EncryptAES:@"samplekey"];
strData = [[NSString alloc] initWithData:objNSData encoding:NSUTF16StringEncoding];
NSLog(@"%@",[objNSData description]);
NSMutableData *objDecryptedData = [objNSData DecryptAES:@"samplekey" andForData:objNSData];
NSLog(@"%@",[objDecryptedData description]);
strData = [[NSString alloc] initWithData:objDecryptedData encoding:NSUTF16StringEncoding];
NSLog(@"after decryption : %@",strData);
There are some sample available on internet just google for them. Here is a stackoverflow post see if it works for you.
NSData-AES Class Encryption/Decryption in Cocoa
精彩评论