开发者

AES256 use XML file

开发者 https://www.devze.com 2023-03-16 22:24 出处:网络
hi friend i want saveobjNSData in my xml file and later i want read my data from file xml and decryptand i want use this code,haw i can convert NSMutableData to string and later convert NSString to NS

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号