Public-key encryption is an asymmetric encryption method in which 2 complementary keys are used. What gets encrypted by one of the keys can be decrypted only by the other. Generally one key of the pair (the “private key”) is kept safe by an individual and the other key (the “public key”) is distributed freely, after which two things can be done.
If a message can be decrypted using the widely distributed (“public”) key, it proves that the author of the message is the individual that holds the private key. Conversely, if a message is encrypted by the public key, it can only be decrypted by the key that was kept safe (the “private key”), making it possible to send a confidential message to the holder of the private key knowing only the public key. While this is the general principle of operation, many modifications are made in order to ensure practical and quick encryption.
Well-known public-key encryption algorithms include Diffie-Hellman and RSA. In Diffie-Hellman, the hardness is based on the discrete logarithm; in RSA it is factoring.
This is a method to secure a channel from eavesdroppers, by agreeing on an encryption key. It is used to let 2 parties agree on a key to be used for encrypting their communications, without actually transmitting said key on the channel between them. If somebody is eavesdropping he will not be able to deduce the key agreed upon from listening to the data.
“Diffie-Hellman key exchange”, relies on the fundamental difficulty of computing the discrete logarithm of a number in the group G. It was invented by Whitfield Diffie and Martin Hellman in 1976. The protocol proceeds in three steps:
At this point both parties (Alice and Bob) have the same (secret) information (ga*b mod p), and can use the shared secret as a key for sending encrypted messages back and forth by the usual methods.
An example conversation (in practice much larger prime numbers will be used) :
Alice and Bob have agreed on an encryption key, gab = 4, and only sent values that can only be used to calculate the key with great difficulty : p = 43, g = 28, ga = 17 and gb = 39. If you want to find out the key, your only choice is to try and determine either a or b. This can only be done by calculating g1, g2, g3, g4, g5, … and compare with the ga value, until found.
By increasing p, the procedure of looking for a can be made arbitrarily difficult. These days p is generally chosen to be “relatively large”, meaning that it should require “a bit less” than 256 bits to represent. Determining a would take on average 2255 steps (although some algorithms can do it in slightly less steps) to determine a.
The main problem is the “man in the middle attack”. Instead of merely eavesdropping, an attacker would place himself between the 2 parties trying to communicate, and he would participate in the key exchange. The spy would agree on one key with the first party, agree on another key with the second party. Then he is able to decrypt (and re-encrypt and retransmit) the data sent over the channel.
However the protocol is useful because it raises the difficulty of eavesdropping. A spy would have to be able to place himself “in between” the two parties he intends to spy on. Also, the spy needs to actively participate in the conversation in order to be able to spy. If he were to put a listening device on the cable, for example, he would not be able to understand the messages sent.
“RSA” stands for “Rivest–Shamir–Adelman”,<ref>''AllAcronyms.com''</ref><ref>Course notes from G6016 “Networks”, at the University of Sussex</ref> the three MIT researchers who discovered the RSA algorithm in 1977. It is probably the most commonly used public key encryption at this time.
RSA is based on the fundamental difficulty of factoring large integers into primes.
The RSA algorithm was put to the test in 1991, when RSA Laboratories released the “RSA Factoring Challenge”. The challenge consisted of a list of progressively larger numbers, which, when fully decrypted, read “The magic words are squeamish ossifrage.”<ref>"The Magic Words Are Squeamish Ossifrage", by Atkins, Graff, Lenstra, and Leyl</ref> Although the challenge was withdrawn in 2007, the RSA algorithm is still widely considered acceptable for business purposes.
The mathematics of public key cryptography, and specifically RSA, are now generally recognized to have been first developed at the British government signals intelligence department GCHQ (Government Communications Headquarters). In 1975 three mathematicians at GCHQ, James Ellis, Clifford Cocks and Malcolm Williamson devised the mathematics for a public key system. However, due the limited computing power available at the time, the idea was not developed into a practical system, and due to the secret nature of the established, papers on the subject were not released to the general mathematical community. The discoveries of Rivest, Shamir and Adelman, although later, were entirely independent.<ref>https://www.bbc.co.uk/news/uk-england-gloucestershire-11475101</ref>
Step 1
Fred needs to send documents to many people. They don't need to be secure, but its important that they know for certain that the message actually came from Fred.
Step 2