开发者

NSMutableData convert to NSString

Why data not similar with objNSData?

NSString *strData = @"Bonjour tout le monde, je voudrais vous présenter la Société fdfdfdf  Futur";
NSMutableData *objNSData = [NSMutableData dataWithData:[strData dataUsingEncoding:NSUTF8StringEncoding]];

objNSData = [objNSData EncryptAES:@"samplekey"];

 NSLog(@"objNSData%@", objNSData);

NSString *str=[[NSString alloc] initWithData: objNSData encoding:NSUTF8StringEncoding];

NSLog(@"str%@",str);

NSMutableData *data = [[NSMutableData alloc] initWithData:[ str dataU开发者_StackOverflow中文版singEncoding:NSUTF8StringEncoding]];
 NSLog(@"data%@",data);


You seem to be storing the NSData representation of the string, then encrypting it and hoping that converting it back will give you the same thing you started out with.

While I'm not entirely sure why you're trying to encrypt your NSData instance, if you want to convert it back into an NSString then you most definitely want to decrypt it on the way back.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜