0

I'm developing a secure multiparty application, but I have a very big problem. The app runs over a BB device, and it connects to a java server running on a pc via sockets, in order to exchange several data. On the BB side, I create a RSAKeyPair and obviously I need to send the public key (RSAPublicKey) to the server, so it can encrypt data and so on... But, the infamous problem is that I'm not able to send the key, because there's not a stream which handles crypto objects like RSAPublicKey. I've tried to cast the key to a different type (String, int, etc.), but it doesn't work.

Someone can give me some advice, please?

zankyr
  • 3
  • 1
  • 3

1 Answers1

0

Invoke getE and getN methods, convert these byte arrays to string in Base64 format and send it to the server. On the server decode Base64 strings and invoke constructor, that gets E and N parameters.

But sending this key over a non-encrypted channel is not a good idea. Consider making HttpsConnection to the server and use this secure connection for data transfer.

  • I tought to extract the `exponent` and the `modulus`, but I was concerned about that the `RSACryptoSystem` necessary in the constructor could create a different key compared to the orignal one. I don't need a secure/private channel, because one of the targets of the app is to test the protocol against malicious party, and I think the public key doesn't need to be hided from third parties (it's public, everyone can obtain it :D). Thanks for the reply. – zankyr Apr 07 '12 at 09:12