chapter six

6 Public Key Encryption and Digital Signatures: Unleashing RSA

 

This chapter covers

  • Using RSA for encrypting data
  • Using RSA for digital signatures

When you buy products online, look for directions to a restaurant, interact with friends and strangers on a social network, or collaborate with coworkers on a video conference call, you depend on public key cryptography. Without public key cryptography, the Internet as we know it would not exist.

Secure communication on the internet relies on the Transport Layer Security (TLS) protocol, which is built upon public key cryptography algorithms. With a solid understanding of public key cryptography, configuring and troubleshooting TLS connections becomes straightforward. Without this knowledge, you may find yourself blindly copying commands from blogs, hoping your changes will fix issues. Public key cryptography is not just a tool—it's an essential foundation for any developer working with secure applications.

This chapter offers application developers a friendly introduction to public key cryptography. The goal is to teach you how to use public key cryptography to solve real-world security problems. The mathematics underlying public cryptography is extremely interesting but is beyond the scope of this book. There are no math equations in this chapter, just sample code that leverages widely used Java libraries to help you develop an intuitive understanding of public key cryptography and how to use 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 Answers to exercises

6.6 Summary