2010-05-21 31 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看起來有如何做到這一點體面的指示。