我正在使用http://aes.online-domain-tools.com来加密我的 NSString,我从中得到的是一个无符号字符数组,例如 c2 84 6b 71 72 6d d2 e7 cd 0b a6 08 cd 85 c3 0c。
然后使用它在我的代码中将其转换为 NSString:
const unsigned char encrpytedAppIDbytes[] = {0xe5, 0x35, 0xdf, 0x72, 0x57, 0xaf, 0xf7, 0xe6, 0x1f, 0x6d, 0x51, 0x1d, 0x26, 0xe8, 0x5e, 0xa2};
NSData *appIDToDecrypt = [NSData dataWithBytes:encrpytedAppIDbytes length:sizeof(encrpytedAppIDbytes)];
NSString *decryptedAppID = [[NSString alloc] initWithData:[appIDToDecrypt AES128DecryptedDataWithKey:@"something"] encoding:NSUTF8StringEncoding];
if([decryptedAppID isEqualToString:@"Something"]){} // This fails even when i look at them in the debugger they are the same.
但是当我试图解密它时,它显示为相同的字符串但是当我将它与相同的 NSString 硬代码进行比较以检查它是否是相同的字符串时它不起作用。这无法通过我的应用程序中的一些身份验证检查。
请指出我在这里做的任何错误。
谢谢,