ideawu / Objective-C-RSA

Doing RSA encryption and decryption with Objective-C on iOS

Home Page:http://www.ideawu.com/blog/post/132.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在iOS9上加密图片转的data返回nil

xiaolouxinyue opened this issue · comments

demo :
NSData *oridata = UIImagePNGRepresentation([UIImage imageNamed:@"QQ20150805"]);
NSLog(@"oridata with public key: %@", oridata);
NSData *encdata = [RSA encryptData:oridata publicKey:pubkey];
NSLog(@"Enctypted with public key: %@", encdata);
result:Enctypted with public key: null

调试发现进入如下if语句里,不知为何?因为图片数据比较大?
size_t outlen = SecKeyGetBlockSize(keyRef) * sizeof(uint8_t);
if(srclen > outlen - 11){
CFRelease(keyRef);
return nil;
}

swift版已经支持分段了,不知oc版何时能更新

我刚刚做了改进, 已经支持分段加密/解密了.