2010-05-21 25 views
0

我有一个缓冲区中的公钥和私钥的原始字节,并希望使用该信息来加密/解密数据。如何在iphone上使用obj-c加载rsa非对称密钥对?

我知道我可以使用SecKeyGeneratePair生成一个密钥,然后将其保存到钥匙圈,但我不希望这样......

基本上,我需要的Objective-C相当于下面的Java代码(使用Bouncycastle)

BigInteger modulus = .... 
BigInteger publicExponent = .... 
BigInteger privateExponent = .... 

RSAKeyParameters pubKey = new RSAKeyParameters(false, modulus, publicExponent); 
RSAKeyParameters privKey = new RSAKeyParameters(true, modulus, privateExponent); 

return new AsymmetricCipherKeyPair(pubKey, privKey); 

任何想法?我真的卡在这个问题....

+0

你解决了这个问题吗?我也有同样的问题,请帮助我,如果你有这个解决方案,请指导我。谢谢。 – 2013-07-03 07:24:29

+0

不,我会使用基于openssl的代码(我已经用于win/linux) – 2013-07-04 09:26:51

回答

0

嗯,我知道的OpenSSL允许你这样做,所以你可能要调查编写的OpenSSL到您的项目......

This link看起来有如何做到这一点体面的指示。