Chapter 5: Using Asymmetric and Hybrid Encryption in Node.js

In the previous chapter, Chapter 4, Symmetric Encryption in Node.js, we looked at how to protect the confidentiality of data by encrypting it using symmetric ciphers. Algorithms like the ones we used (AES and ChaCha20-Poly1305) are highly secure and fast, but they use a single key (in this case, a shared key) for both encryption and decryption. Consequently, to send an encrypted message to another person, both parties need to know the shared key too: safely transmitting that over an insecure channel (such as the internet) can become a problem.

As we briefly mentioned in the previous chapter, for these situations, it's often convenient to leverage a different class of cryptographic ...

Get Essential Cryptography for JavaScript Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.