The Theory of Cryptography
- Jun 4, 2004
One of the essential ingredients of e-business and enterprise computing is cryptography. Cryptography plays a critical role in J2SE and J2EE security, as Part IV of this book demonstrates.
This chapter explains the theory of cryptography that will be used in Chapters 11, 12, and 13. First, this chapter describes secret-key cryptographic systems, as they are at the heart of most cryptographic services, including bulk-data encryption, owing to their inherent performance advantage. Next is an overview of public-key encryption, which is essential for conducting e-business, particularly across public networks, because of the relative ease of distributing cryptographic keys. In Chapter 11, secret- and public-key cryptography services are described in the context of the standard Java APIs: the Java Cryptography Architecture and the Java Cryptography Extension.
For readers who may feel intimidated by the mathematical jargon associated with cryptography, we have tried to explain the mathematics associated with cryptography in a clear and simple way. Our intent is to demystify the concepts and terms surrounding cryptography.
10.1 The Purpose of Cryptography
The purpose of cryptography is to protect data transmitted in the likely presence of an adversary. As shown in Figure 10.1, a cryptographic transformation of data is a procedure by which plaintext data is disguised, or encrypted, resulting in an altered text, called ciphertext, that does not reveal the original input. The ciphertext can be reverse-transformed by a designated recipient so that the original plaintext can be recovered.
Figure 10.1. The Process of Encryption and Decryption
Cryptography plays an essential role in
Authentication. This process to prove the identity of an entity can be based on something you know, such as a password; something you have, such as an encryption key or card; something you are, such as biometric measurements, including retinal scans or voice recognition; or any combination of these.
Data confidentiality. With this property, information is not made available or disclosed to unauthorized individuals, entities, or processes. When two or more parties are involved in a communication, the purpose of confidentiality is to guarantee that only those parties can understand the data exchanged. Confidentiality is enforced by encryption.
Data integrity. This property refers to data that has not been changed, destroyed, or lost in an unauthorized or accidental manner. The need for data integrity is especially evident if data is transmitted across a nonsecure network, such as the Internet, where a man-in-the-middle attack can easily be mounted. Integrity is enforced by mathematical functions applied to the message being transmitted.
Nonrepudiation. Repudiation is the denial by one of the entities involved in a communication of having participated in all or part of the communication. Nonrepudiation is protection against repudiation and can be of two types.
Nonrepudiation with proof of origin provides the recipient of data with evidence that proves the origin of the data and thus protects the recipient against an attempt by the originator to falsely deny sending the data. Its purpose is to prove that a particular transaction took place, by establishing accountability of information about a particular event or action to its originating entity.
Nonrepudiation with proof of receipt provides the originator of data with evidence proving that data was received as addressed and thus protects the originator against an attempt by the recipient to falsely deny receiving the data.
In most cases, the term nonrepudiation is used as a synonym of nonrepudiation with proof of origin. Like integrity, nonrepudiation is based on mathematical functions applied to the data being generated during the transaction.
Keeping secrets is a long-standing tradition in politics, the military, and commerce. The invention of public-key cryptography in the 1970s has enabled electronic commerce to blossom in systems based on public networks, such as the Internet.
There are two primary approaches to cryptography (see Figure 10.2). In secret-key cryptography, the key used to decrypt the ciphertext is the same as the key that was used to encrypt the original plaintext. In public-key cryptography, the key used to decrypt the ciphertext is different from but related to the key that was used to encrypt the original plaintext.
Figure 10.2. Secret-Key and Public-Key Encryption
Each approach has its strengths and weaknesses. Many of the cryptographic services enterprise applications need use both approaches. However, most application developers will not be aware of the underlying machinery that is deployed. For example, most users of SSL-enabled Web browsers are not aware that both public- and secret-key cryptography are essential parts of the SSL protocol.
Naively, we can think about cryptography primarily as a means for keeping and exchanging secrets. This is the confidentiality property that cryptography affords us. However, other essential cryptographic services are provided. When exchanging a message, whether encrypted or not, we often want to verify its integrity. Someone, particularly in public networks, may have modified the message. Data-integrity verification includes authenticating the origin of the message. Was the message from the source that we think sent the message? Once we accept that the message is from an authenticated entity and was not modified after being created, we also want to consider whether the sender can repudiatedeny sendingthe message by claiming that someone stole the cryptographic key used to authenticate the message. Therefore, nonrepudiation is an essential feature of cryptographic systems e-businesses use.