ideawu / Objective-C-RSA

Doing RSA encryption and decryption with Objective-C on iOS
http://www.ideawu.com/blog/post/132.html
Other
1.15k stars 280 forks source link

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

Open xiaolouxinyue opened 8 years ago

xiaolouxinyue commented 8 years ago

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; }

xiaolouxinyue commented 8 years ago

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

ideawu commented 8 years ago

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

xiaolouxinyue commented 8 years ago

3q