

When you "generate a key", the software comes up with two very large numbers, and from them, two keys (a keypair). One of these is your "public" key, and the other is your "private" key. Your public key, as the name implies, is to be distributed to the world  your private key should be closely guarded (the whole system depends on it). Using one of the keys, and some complicated mathematics, one can encrypt a message such that only 8the other key can decrypt it.
So, when you "sign" an email, this is what happens:
 the computer generates a "unique" mathematical
summary of the document
 the software uses your private key to
encrypt the summary
 the summary is appended or attached to the document
Because you used your private key, only your public key (which anyone should be able to get) will decrypt the summary. And because the summary is unique to the document  and because only your private key could have encrypted it  no one can just take your digital signature and attach it to another message. Or change the message you sent!



The following text is taken from chapter 1 of the document
Introduction to Cryptography in the PGP 6.5.1 documentation. Copyright © 19901999 Network Associates, Inc. and its Affiliated Companies. All Rights Reserved.
PGP combines some of the best features of both conventional and public key cryptography. PGP is a hybrid cryptosystem. When a user encrypts plaintext with PGP, PGP first compresses the plaintext. Data compression saves modem transmission time and disk space and, more importantly, strengthens cryptographic security. Most cryptanalysis techniques exploit patterns found in the plaintext to crack the cipher. Compression reduces these patterns in the plaintext, thereby greatly enhancing resistance to cryptanalysis. (Files that are too short to compress or which don't compress well aren't compressed.)
PGP then creates a session key, which is a onetimeonly secret key. This key is a random number generated from the random movements of your mouse and the keystrokes you type. This session key works with a very secure, fast conventional encryption algorithm to encrypt the plaintext; the result is ciphertext. Once the data is encrypted, the session key is then encrypted to the recipient's public key. This public keyencrypted session key is transmitted along with the ciphertext to the recipient.
Figure 14. How PGP encryption works
Decryption works in the reverse. The recipient's copy of PGP uses his or her private key to recover the temporary session key, which PGP then uses to decrypt the conventionallyencrypted ciphertext.
Figure 15. How PGP decryption works
The combination of the two encryption methods combines the convenience of public key encryption with the speed of conventional encryption. Conventional encryption is about 1, 000 times faster than public key encryption. Public key encryption in turn provides a solution to key distribution and data transmission issues. Used together, performance and key distribution are improved without any sacrifice in security.



The following text is taken from chapter 1 of the document
Introduction to Cryptography in the PGP 6.5.1 documentation. Copyright © 19901999 Network Associates, Inc. and its Affiliated Companies. All Rights Reserved.
Keys:
A key is a value that works with a cryptographic algorithm to produce a specific ciphertext. Keys are basically really, really, really big numbers. Key size is measured in bits; the number representing a 1024bit key is darn huge. In public key cryptography, the bigger the key, the more secure the ciphertext.
However, public key size and conventional cryptography's secret key size are totally unrelated. A conventional 80bit key has the equivalent strength of a 1024bit public key. A conventional 128bit key is equivalent to a 3000bit public key. Again, the bigger the key, the more secure, but the algorithms used for each type of cryptography are very different and thus comparison is like that of apples to oranges.
While the public and private keys are mathematically related, it's very difficult to derive the private key given only the public key; however, deriving the private key is always possible given enough time and computing power. This makes it very important to pick keys of the right size; large enough to be secure, but small enough to be applied fairly quickly. Additionally, you need to consider who might be trying to read your files, how determined they are, how much time they have, and what their resources might be.
Larger keys will be cryptographically secure for a longer period of time. If what you want to encrypt needs to be hidden for many years, you might want to use a very large key. Of course, who knows how long it will take to determine your key using tomorrow's faster, more efficient computers? There was a time when a 56bit symmetric key was considered extremely safe.
Keys are stored in encrypted form. PGP stores the keys in two files on your hard disk; one for public keys and one for private keys. These files are called keyrings. As you use PGP, you will typically add the public keys of your recipients to your public keyring. Your private keys are stored on your private keyring. If you lose your private keyring, you will be unable to decrypt any information encrypted to keys on that ring.
Digital signatures:
Amajor benefit of public key cryptography is that it provides a method for employing digital signatures. Digital signatures enable the recipient of information to verify the authenticity of the information's origin, and also verify that the information is intact. Thus, public key digital signatures provide authentication and data integrity. A digital signature also provides nonrepudiation, which means that it prevents the sender from claiming that he or she did not actually send the information. These features are every bit as fundamental to cryptography as privacy, if not more.
A digital signature serves the same purpose as a handwritten signature. However, a handwritten signature is easy to counterfeit. A digital signature is superior to a handwritten signature in that it is nearly impossible to counterfeit, plus it attests to the contents of the information as well as to the identity of the signer.
Some people tend to use signatures more than they use encryption. For example, you may not care if anyone knows that you just deposited $1000 in your account, but you do want to be darn sure it was the bank teller you were dealing with.
The basic manner in which digital signatures are created is illustrated in Figure 16. Instead of encrypting information using someone else's public key, you encrypt it with your private key. If the information can be decrypted with your public key, then it must have originated with you.
Figure 16. Simple digital signatures


Project EVA  2004 
