OSStatus -9809在解密时

ss *_*rup 2 iphone rsa

我想实现的RSA加密和解密算法作为我的iPhone应用程序的一部分.(的Xcode 4.2,IOS SDK 5.0)我生成使用SecKeyGeneratePair和使用SecKeyEncrypt加密密钥.这两个都返回OSStatus 0.

但是在使用SecKeyDecrypt进行解密时,我将OSStatus作为-9809.请帮忙; 哪里出错了

编辑:感谢您的快速回复.我复制并粘贴了以下链接中的代码:

http://www.iphonedevsdk.com/forum/iphone-sdk-development/17242-rsa-generating-keypair-so-slowly.html

dra*_*gos 12

原因是Apple页面上有拼写错误

NSData *encryptedData = [NSData dataWithBytes:cipherBuffer length:dataLength];
Run Code Online (Sandbox Code Playgroud)

它应该是:

NSData *encryptedData = [NSData dataWithBytes:cipherBuffer length:cipherBufferSize];
Run Code Online (Sandbox Code Playgroud)