1
我在使用Rijndael加密算法進行加密時,它在NSData中加密。我想把加密的NSdata放到NSString中。我試圖將其轉換爲字符串,但它返回零。有任何人有任何解決方案進入字符串。加密數據返回零字符串
我做這樣的
NSString *passphrase = @"super-secret";
NSStringEncoding myEncoding = NSUTF8StringEncoding;
NSString *alphaPlain = @"This is a encryption test.";
NSData *alphaDataPlain = [alphaPlain dataUsingEncoding:myEncoding];
NSLog(@" SimpleText value : %@",alphaPlain);
NSData *alphaDataCypher = [alphaDataPlain AESEncryptWithPassphrase:passphrase];
NSString *alphaStringCypher = [[NSString alloc] initWithData:alphaDataCypher encoding:myEncoding];
NSLog(@" Encrypted value : %@",alphaStringCypher);
它返回零值。
由於
嗨,感謝您的回覆,加密的字符串是必需的b'coz我必須通過server.If任何其他溶膠。 – iPhoneDev