Following unit test simulates usage of public-private key encryption between two nodes. Basically, Client Node requests to Server Node with a public key and Server Node returns a data back to Client Node encrypted with client provided public key. This data can only be decrypted by Client Node using private key.
RSA 2048 bit encryption is used. Public Key which is byte[] is conveyed from client node to server node as Base64 encoded. Also give attention that how Public Key is reconstructed on server side from byte [].