chapter six

6 Public key encryption and digital signatures: Unleashing RSA

 

This chapter covers

  • Using RSA to encrypt data
  • Using RSA for digital signatures

When you buy products online, look up directions to a restaurant, interact with friends and strangers on a social network, or collaborate with co-workers on a video conference call, you depend on public key cryptography. Without it, the Internet as we know it wouldn’t exist.

Secure communication on the internet relies on the Transport Layer Security (TLS) protocol, which is built on public key cryptography. With a solid understanding of public key cryptography, configuring and troubleshooting TLS connections becomes straightforward. Without this knowledge, you may blindly copy commands from blog posts, hoping that your changes will fix the problem. Public key cryptography isn’t only a tool but also an essential foundation for any developer working with secure applications.

This chapter offers application developers a friendly introduction to public key cryptography. Its goal is to teach you how to use it to solve real-world security problems. The mathematics behind public key cryptography is extremely interesting but beyond the scope of this book. You won’t find any equations in this chapter; instead, you’ll see sample code that uses popular Java libraries to help you develop an intuitive understanding of public key cryptography and apply it in your applications.

6.1 The secret-key distribution problem

6.1.1 Exercises

6.2 Public key cryptosystems

6.2.1 Exercises

6.3 RSA public key cryptosystem

6.3.1 Configuring RSA

6.3.2 Hybrid encryption

6.3.3 Signing data with RSA

6.3.4 Exercises

6.4 Java support for RSA

6.5 Exercise answers

Summary