Understanding asymmetric encryption
As we learned in Chapter 2, Symmetric Encryption and Decryption, symmetric encryption algorithms use the same key for encryption and decryption. Asymmetric encryption algorithms, conversely, use two keys – a public key and a private key. A public key and its corresponding private key form a keypair. The public key is used for encryption and the private key is used for decryption.
Why do we need the complication with two keys? Why can’t we just always use symmetric encryption with one key? In short, asymmetric encryption is needed when it is difficult or impossible to send a secret key and ensure that no one eavesdropped on the transferred key. Let’s imagine that Alice wants to send a message to Bob over a non-secure channel – for example, over the internet. On the internet, transit hosts between Alice and Bob can eavesdrop on the passing traffic and even change it. Alice does not want anyone to eavesdrop on the message...