下面是我尝试加密数据的代码
输入/调用我的加密方法:
[self myED:@"wcc123" :@"hahaha" :@"yyyy"];
- (NSData*) myED:(NSData*)data :(NSData*) key :(NSData*)iv{
@try {
// Try something
NSLog( @"Original String: %@", data );
size_t bufferSize = [data length]*2;
void *buffer = malloc(bufferSize);
size_t encryptedSize = 0;
CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt, kCCAlgorithmAES128, kCCOptionPKCS7Padding,
[key bytes], [key length], [iv bytes], [data bytes], [data length],
buffer, bufferSize, &encryptedSize);
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
// Added to show finally works as well
}
return nil;
}
但是,当尝试运行此代码时,它会在下面提示我异常
2012-07-03 16:52:44.776 wccTest[930:f803] 异常:-[__NSCFConstantString 字节]:
任何人都可以对此提供帮助/建议吗?