Asymmetric (public key) encryption in Java

In the symmetric encryption paradigm we've described, the same key is used for encryption and decryption. This means if Alice sends a message to Bob or vice versa, the two parties must somehow have agreed on a key to use for the conversation.

One solution to this problem is via an asymmetric encryption algorithm. In asymmetric encryption, also known as public key encryption or public key cryptography:

A common paradigm in a centralised client-server system is that a private key is held securely on the server, while the corresponding public key is distributed to all clients.

Next: RSA public-key encryption

In practice, by far the most commonly used public key encryption system is RSA, named after its inventors. On the next page, we look at how to perform RSA encryption in Java.