I have a requirement to secure the Java RMI calls with Asymmetric key cryptography (RSA) in a Peer 2 Peer File sharing application.
I referred this, but it uses a passphrase (Symmetric Key) to XOR the messages. I want that the client encrypts the RMI Socket stream with server's public key and the server should use its private key to decrypt the socket input stream. Assumption: Every node in the P2P File sharing application has each other's public key
Since there can be multiple client-servers (P2P nodes), the clients should use the relevant server's public key to encrypt the socket stream data.
I could not find any other reference using asymmetric key to secure RMI calls. Please help.
UPDATE:
I'm a student and this is a university project where I have to secure the communications happening over the RMI using RSA cryptography. So, I don't have any choice left.
In the previous projects, I created a Napster & Gnutella style P2P file sharing system. Now the task is to use RSA to encrypt the communications between nodes using their public-private keys.
I really appreciate any help/guidance in this direction. Please do not close this question.
UPDATE 2
Implement RSA cryptography without using in-built libraries except java.math.BigInteger
and java.security.SecureRandom