1

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 monde, 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);
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256
djboss
  • 59
  • 1
  • 6

1 Answers1

0

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

Community
  • 1
  • 1
Rahul Vyas
  • 28,260
  • 49
  • 182
  • 256