views:

51

answers:

1

I have the raw bytes of public and private key in a buffer and want to use that information to encrypt / decrypt data.

I do know that I could generate a keypair using SecKeyGeneratePair and then save it to the keychain, but i don't want that...

essentially, i need the Objective-C equivalent of the following Java Code (using 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);

Any ideas? I'm really stuck on that problem....

+1  A: 

Well, I know that OpenSSL allows you to do this, so you might want to investigate compiling OpenSSL into your project...

This link looks like it has decent instructions on how to do that.

Dave DeLong