This article needs additional citations for verification. (November 2014) (Learn how and when to remove this template message)
If the sender and receiver wish to exchange encrypted messages, each must be equipped to encrypt messages to be sent and decrypt messages received. The nature of the equipping they require depends on the encryption technique they might use. If they use a code, both will require a copy of the same codebook. If they use a cipher, they will need appropriate keys. If the cipher is a symmetric key cipher, both will need a copy of the same key. If an asymmetric key cipher with the public/private key property, both will need the other's public key.
Channel of exchange
Key exchange is done either in-band or out-of-band. In in-band key exchange, keys are exchanged through the same communication channel that will be encrypted. In out-of-band key, keys are exchanged through a channel other than the one that will be encrypted.
The key exchange problem
The key exchange problem is how to exchange whatever keys or other information are needed so that no one else can obtain a copy. Historically, before the invention of public key cryptography (asymmetrical cryptography), symmetric key cryptography utilized a secret key to encrypt and decrypt information. For two parties to communicate confidentially, they must first exchange the secret key so that each party can read encrypted messages as well as send them. This process is known as the key exchange. The overarching problem with symmetrical cryptography or single key cryptography, is that it requires a secret key to be communicated through trusted couriers, diplomatic bags, or any other secure communication channel. If two parties could not establish a secure initial key exchange, they cannot communicate securely without the risk of the key being compromised. Public key cryptography uses a two key system where the respective key functions of encryption and decryption are separated into their respective keys. One key is used for decryption and one key is used for encryption. The labels of public key and private key are used to describe which of the key pair is kept hidden and applied selectively for each and every algorithm. Eg. For public key encryption algorithms such as RSA, the decryption key is kept secret and thus is known as the private key, whereas for the Digital Signature Algorithm (DSA), the decryption key is the public key. In the case of public key encryption algorithms, only the encryption key is shared as the public key. Known as the Diffie-Hellman key exchange, the encryption key can be openly communicated as it proses no risk to the confidentiality of encrypted messages. One party exchanges the keys to another party where they can then encrypt messages using the key and send back the cipher text. Only the decryption key or private key in this instance, can decrypt that message. At no time during the Diffie-Hellman key exchange is any sensitive information at risk of compromise as opposed to symmetrical key exchange.
In principle, the only remaining problem was to be sure (or at least confident) that a public key actually belonged to its supposed owner. Because it is possible to 'spoof' another's identity in any of several ways, this is not a trivial or easily solved problem, particularly when the two users involved have never met and know nothing about each other.
Diffie–Hellman key exchange
In 1976, Whitfield Diffie and Martin Hellman published a cryptographic protocol called the Diffie–Hellman key exchange (D–H) based on concepts developed by Hellman's PhD student Ralph Merkle. The protocol enables users to securely exchange secret keys even if an opponent is monitoring that communication channel. The D–H key exchange protocol, however, does not by itself address authentication (i.e. the problem of being sure of the actual identity of the person or 'entity' at the other end of the communication channel). Authentication is crucial when an opponent can both monitor and alter messages within the communication channel (AKA man-in-the-middle or MITM attacks) and was addressed in the fourth section of the paper.
Public key infrastructure
Public key infrastructures (PKIs) have been proposed as a way around this problem of identity authentication. In their most usual implementation, each user applies to a 'certificate authority' for a digital certificate which serves for other users as a non-tamperable authentication of identity, at the risk of compromising every user in case the CA itself is compromised.
Several countries and other jurisdictions have passed legislation or issued regulations encouraging PKIs by giving (more or less) legal effect to these digital certificates. Several commercial firms, and a few government departments, have established such certificate authorities. VeriSign is the most prominent commercial firm.
This does nothing to solve the problem though, as the trustworthiness of the CA itself is still not guaranteed for any particular individual. It is a form of argument from authority fallacy. For actual trustworthiness, personal verification that the certificate belongs to the CA and establishment of trust in the CA are required. This is usually not possible.
For those new to such things, these arrangements are best thought of as electronic notary endorsements that “this public key belongs to this user”. As with notary endorsements, there can be mistakes or misunderstandings in such vouchings. Additionally, the notary itself can be untrusted. There have been several high-profile public failures by assorted certificate authorities.
Web of trust
At the other end of the conceptual range is the web of trust system, which avoids central Certificate Authorities entirely. Each user is responsible for getting any certificate from another before using that certificate to communicate with, vet digital signatures from, ... the user claimed to be associated with the particular public key in a certificate. PGP (and GPG, an implementation of the OpenPGP Internet Standard) employ just such a web of trust mechanism. Together they are the most widely used high quality cryptographic system in the world.
Password-authenticated key agreement
Quantum key exchange
The BB84 key exchange protocol—like any quantum key exchange protocol—exploits certain properties of quantum physics to ensure its security. Since quantum mechanics ensures physical traces as a result of mere observation, it provides protection against man-in-the-middle attacks that cannot, as a matter of physical principle, be circumvented.
- The possibility of Non-Secret digital encryption J. H. Ellis, January 1970.
- Non-Secret Encryption Using a Finite Field MJ Williamson, January 21, 1974.
- Thoughts on Cheaper Non-Secret Encryption MJ Williamson, August 10, 1976.
- New Directions in Cryptography W. Diffie and M. E. Hellman, IEEE Transactions on Information Theory, vol. IT-22, Nov. 1976, pp: 644–654.
- Cryptographic apparatus and method Martin E. Hellman, Bailey W. Diffie, and Ralph C. Merkle, U.S. Patent #4,200,770, 29 April 1980
- The First Ten Years of Public-Key Cryptography Whitfield Diffie, Proceedings of the IEEE, vol. 76, no. 5, May 1988, pp: 560–577 (1.9MB PDF file)
- Menezes, Alfred; van Oorschot, Paul; Vanstone, Scott (1997). Handbook of Applied Cryptography Boca Raton, Florida: CRC Press. ISBN 0-8493-8523-7. (Available online)
- Singh, Simon (1999) The Code Book: the evolution of secrecy from Mary Queen of Scots to quantum cryptography New York: Doubleday ISBN 0-385-49531-5