# Overview of Public Key Encryption ```Public Key Encryption
By: Brandon Crosser
Overview of Public Key Encryption
Encryption is the act of encoding text in such a way that only those with the
decryption mechanism can understand the content. The simplest form of encryption
involves representing each character of text with a specific number or character. These
rudimentary forms of encryption were used as children’s toys such as the Radio Orphan
Annie secret decoder pins. These basic encryption techniques require a decryption
mechanism called a key to recover the original text. New technologies and tools in
decryption have rendered this elementary form of encryption nearly useless.
One problem with basic encryption is that the use of computers has made
breaking such ciphers virtually effortless. This is mainly due to the fact that there are a
finite number of mappings from a set of letters to a set of numbers. Modern processors
can check all of these mappings until the correct key is found. Another problem with this
style of encryption is that the sender of the message must send the key to the receiver.
However, this exchange of the key requires a secure channel. A secure channel could be
a physical handoff or a phone call to exchange the key.
Public key encryption differs from basic encryption in that it uses two keys rather than
only one. One key is used to encrypt the text, while the other key is used to decrypt the
data. The encryption key is a public key and is available to everyone wishing to send a
message. The decryption key is a private key and is only known by the receiver of the
message. The private key is mathematically related to the public key, yet nearly
impossible to compute from the public key.
Public key encryption offers many answers to the problems presented by basic
encryption. In public key encryption, no secure channel must be present for the exchange
of the key. Even using a super-computer, public key encryption is still very time
consuming to crack.
The security provided by public key encryption is due to the fact that the central
mathematical concepts behind it involve multiplying large prime numbers together. To
crack this kind of cipher, the factorization of this product of primes is needed. However,
there is no algorithm that factors large numbers efficiently. It has been demonstrated that
the time required to factor products of primes raises exponentially with the size of the
product. RSA Security offers rewards for the factorization of certain large numbers. In
April of 2004 a worldwide team of eight mathematicians solved the RSA-576 challenge.
It took this team over three months to factor this 174-digit number using approximately
100 workstations.
In practice, public key encryption would generally use two primes of
approximately 100 to 200 digits in length. The key size would vary with the sensitivity
of the information being transmitted. Less sensitive information would use a smaller key
size to increase efficiency of the encryption and decryption processes. Also, in practice
strings of characters would be used rather than individual characters. So each
combination of six letters, for example, would be represented by different numbers.
There are many reasons that public key encryption has gained popularity in many
current encryption processes. Programs utilizing public key encryption techniques are
widely available at little or no cost.
How it works:
Here it will be shown that beginning with two primes, say p and q, it is possible to
recover the original text by using their product and the product of each of them decreased
by one.
Proof:
Let p and q be large primes.
Let n  pq and φ(n)  (p-1 )(q-1 ).
Given an E  (E , φ(n))  1,  D  DE  1 mod ((n)).
T represents the numerical equivilent of the text to be encrypted.
To obtain the cypher tex t C , let C  T E mod (n).
As DE  1 mod ((n)), DE  k(n)  1.
So C D  T DE  T k ( n )1 mod (n) for some k  Z .
Euler' s Totient Theorem says that T  ( n )  1 mod (n).
Hence C D  1k  T mod (n).
C D  T mod (n).
Example:
For this example we will numerically represent the letter ‘A’ by 1, ‘B’ by 2, ‘C’ by 3 and
so on. For simplicity sake we will choose p and q to be rather small.
Let p  23 and q  19. Thus n  437 and φ(n)  396. We will also choose E  13. It
can be verified that 13  61  1 mod( 396). We will encrypt &quot; BRANDON CROSSER&quot;.
So the numerical equivalent of this text woul d be
2 18 1 14 4 15 14 0 3 18 15 19 19 5 18.
Raising each of these numbers to the 13th power and reducing mod(437) gives us the cipher tex t
326 94 1 287 85 143 287 0 147 94 143 76 76 435 94.
This gives a general idea of what an encrypted message would look like.
The reciever can now raise each of these numbers to the 61st power whic h yields
2 18 1 14 4 15 14 0 3 18 15 19 19 5 18.
This delivers the original text of “BRANDON CROSSER” to the receiver.
C++ Program:
A pair of C++ programs can also be found at this site which encrypt and decrypt
messages. The Encrypt.exe program prompts the user to input the file name to be
encrypted. This file must be located in the same directory as the program at run-time. It
will then prompt the user whether to change the public key or not. The program then
runs and outputs a file named Encrypted.txt to the same directory. This file can then be
sent to the receiver. The receiver can place this file in the directory including the
Decrypt.exe program. Upon running this program it will prompt the user to choose a
name for the output file. Following this the user is asked to give the name of the file to
be decrypted. The program runs leaving the original message in the directory under the
user-selected name.
```