How Does Encryption Work?

The object of this section is to provide a basic overview of how modern encryption technology works. To understand precisely the mechanics of encryption would require months and a solid foundation in advanced mathematics. Given that this section is being written only to provide a background for understanding the legal issues surrounding encryption, we will only skim over the main features of encryption.

Before we jump into encryption, let’s start with the concept of data interception. Data interception occurs when an unauthorized person[2] is able to seize a piece of information that is being sent from person A to person B before B receives that information. Let’s consider an example. Suppose that I wanted to send Bill a message that reads, “HELLO.” The problem is that a hacker might intercept my message before Bill receives the message and be able to read what I am trying to communicate.[3] Now, in a message as simple as “HELLO,” this interception may seem rather harmless. But suppose that instead of just sending Bill a “HELLO” message, I was sending Bill my credit card number for an online purchase of books. When we think about the possibility of credit card numbers getting into the wrong hands, we see the potential seriousness of data interception.

How can I protect my messages from being intercepted by unauthorized people? Unfortunately, because information on the Internet passes through public wires, it is not possible to ensure that unauthorized users will not be able to intercept data. However, even if these unauthorized users are able to intercept data, it is possible to mask the data so that hackers and other snoopers cannot read the data even if they intercept it. This process of translating data into a code that makes it more difficult for unauthorized users to read is called encryption, or cryptography. For example, instead of sending Bill the message, “HELLO,” I could have sent him the message, “8-5-12-12-15.” Now, the message “8-5-12-12-15” seems like gibberish and may not be understood by a hacker, even if she is able to intercept my message. But suppose that along with the “8-5-12-12-15” message, I let Bill know that each number in my message should be replaced by the corresponding letter in the alphabet. Given this information, Bill will be able to decrypt, or decipher, my message.

The information that Bill used to decipher my encrypted message is called a key. Keep in mind here that I used the same key to encrypt the message (i.e., numbers in the message to be replaced by the corresponding letter in the alphabet) as Bill used to decrypt the message. This is called the single-key system of encryption. Until the mid-1970s, encryption operated under this system -- i.e., the same key that was used to encrypt a message was also used to decrypt it.[4] However, there was a great risk inherent in this single-key system: if you lose that single key, then you risk losing all the information that was encrypted by that key.[5] For example, if the key that “numbers should be replaced by the corresponding letters of the alphabet” gets lost, and it is impossible to decipher the code without the key, then Bill will never be able to decrypt the message that I sent to him. Furthermore, the single-key system always required that you transport the key needed to decrypt the encrypted message, which added a further risk that the key would be lost during transport.[6]

The pitfalls of the single-key system led computer scientists searching for an alternative. And in the mid-1970s, Whitfield Diffie and Martin Hellman devised a system that is still used today by most encryption programs.[7] Their system, the dual-key system, relied on two keys -- a public key and a private key. Under the dual-key system, what is encrypted by the public key can only be decrypted by the corresponding private key.[8] Furthermore, the system is set up such that even with one key, it is impossible to infer or derive the other.[9] So how does this system work? Suppose that I wanted to send a message to Bill again. Under the dual-key system, Bill would have a key that he can make publicly available (the public key). Therefore, I can take my message and encrypt it using Bill’s public key. I then send the encrypted message to Bill. The message that I have sent (which has been encrypted by Bill’s public key), can only be decrypted by using Bill’s private key. And since Bill is the only one who has his private key, no one other than Bill (and anybody else who he authorizes to use his private key) can read the encrypted message that I have sent to him. Once Bill receives my encrypted message, he can decrypt it with his private key and read the message.

Under the process just described, it is clear that only Bill will be able to read the message that I have sent to him. But how will Bill know that I was the one who sent the message? After all, anyone can encrypt a message using Bill’s public key. One way around this problem is before I send the message that I have encrypted with Bill’s public key, I can encrypt it first with my private key. Then, when Bill receives my encrypted message, he can first decrypt it with my public key, and then decrypt it again with his private key. After the first decryption, Bill can be sure that I was the one who sent him the message. And after the second decryption, Bill can be sure that only he can read the content of the message.

The dual-key system’s advantage over the single-key system is clear. Under the dual-key system, Bill and I did not need to send a single key back and forth.[10] I simply used Bill’s public key to encrypt the message, and Bill used his corresponding private key to decrypt it. There was no risk that the key used to encrypt the message would get lost. Hence, the risk of lost information under the dual-key system is much lower than under the single-key system.[11]

In order to get a public and private key to encrypt messages, you need to have a software program. Currently, the most popular dual-key software programs are called RSA and PGP (Pretty Good Privacy).

Next: Survey of Issues Surrounding Encryption...

Please send inquiries to

Welcome | Registration | Discussion | Resources |
The Berkman Center for Internet & Society