📄 ch17.htm
字号:
<HTML><HEAD><TITLE>Chapter 17 -- How Encryption Works </TITLE><META></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910"><H1><FONT SIZE=6 COLOR=#FF0000>Chapter 17</FONT></H1><H1><FONT SIZE=6 COLOR=#FF0000>How Encryption Works</FONT></H1><HR><P><CENTER><B><FONT SIZE=5><A NAME="CONTENTS">CONTENTS</A></FONT></B></CENTER><UL><LI><A HREF="#HowEncryptionWorks">How Encryption Works</A><LI><A HREF="#HowCryptosystemsWork">How Cryptosystems Work</A></UL><HR><P>Encryption works to protect against many threats to the securityof an intranet. There is vulnerability during data transmissionwhen people capture data sent across an intranet, or from theintranet through the Internet. This is a particular problem whentransmitting sensitive information. Data is also vulnerable toa variety of threats while stored, including unauthorized accessand theft.<P>When information and data is <I>encrypted</I>, it is altered sothat to anyone other than the intended recipient it will looklike meaningless garble. Encrypted information needs to be <I>decrypted</I>in order to view it and understand it-that is, turned back tothe original message by the recipient, and only by the recipient.<P>There are several terms you'll need to understand in the encryptionprocess: keys, algorithm, hash function, message digest, and digitalfingerprint. <P>The heart of understanding how cryptosystems work is to understandthe concept of <I>keys</I>. There are two basic kinds of encryption:<I>secret-key (symmetric) </I>and <I>public-key (asymmetric) cryptography</I>.Keys are secret values that are used by computers in concert withcomplex mathematical formulas called algorithms to encrypt anddecrypt messages. The idea behind keys is that if someone encryptsa message with a key, only someone with a matching key will beable to decrypt it. Key size is the critical characteristic ofencryption systems. Size is counted in bits. DES (Data EncryptionStandard) is the most common secret key system. Both the senderand the receiver need to have copies of the same secret key. DESis used by the U.S. government and relies on a 56-bit key. Thisis the minimum size for effectiveness. DES performs 16 sequentialcalculations of substitutions on separate halves of the messageto derive the encrypted result. DES is a symmetric process, linearcalculation, and results in one secret key. <P>RSA encryption, named after the MIT professors who developed itin 1977 (Ronald Rivest, Adi Shamir, and Leonard Adleman), differsfrom DES in both technique to derive the result and because RSAuses key pairs instead of one key. The key pairs of RSA are derivedby multiplying two large (each a few hundred bits long) primenumbers (factorization) and additional mathematical calculations.The RSA algorithm is the best-known public-key system. In public-keycryptography, a pair of keys are involved: a <I>public key</I>and a <I>private key</I>. Every person has both a public key anda private key. An individual's public key is made freely available,while the private key is exclusively known to each individual.If the public key is used to encrypt a message, only the companionprivate key can decrypt the message. If someone wanted to senda message to you, for example, he or she would encrypt it withyour public key. Only you, with your private key, would be ableto decrypt the message and read it. Your public key could notdecrypt it. This means that once the message is encrypted, noteven the sender can decrypt the message. Conversely, messagesencrypted with private keys can only be decrypted with the matchingpublic key. This ensures the authenticity of the sender to therecipient: Only someone with the private key code can encrypta message that can be decrypted with that public key.<P>You may have heard about the Clipper chip and the Skipjack methodto program a secret key. Skipjack uses an 80-bit key, so wouldbe tougher to crack than DES. The controversy over the Clipperchip is not about the effectiveness of Skipjack, rather it isthe fact that the chip contains a "back-door" that wouldallow others (theoretically only specifically authorized governmentagents) to get at the secret key, completely defeating the reasonspeople use encryption, privacy, and security.<P>PGP (Pretty Good Privacy) is an encryption program that uses a128-bit key, and furthermore, it uses the RSA algorithm to encryptthe encryption of the 128-bit key. This means that PGP has 2<SUP>128</SUP>possible keys. PGP as an implementation with RSA, uses key pairs,also known as public and private keys.<P>When a message is run through an encryption algorithm (like RSA)it can also call a hash function. Algorithms are essentially themathematical method used to generate the keys. The hash functionis used as a method to ensure that a message hasn't been altered.For example, if a sent message was 500 words long, but arrivedas a message 501 words long, you could tell something had changedin transit. Word count by itself is not sufficient for ensuringthat a message hasn't been altered since you could have multiplechanges that have a net result of 500 words, and there would beno way to tell that the 500 words contained different words thanthe original. Hash functions on messages, therefore, are morecomplex. For example, it might use the number of words and thenumber of letters as components in the calculation. Because themessage is the basis for the algorithm's calculation the resultis unique to the message. <P>This process produces a number known as the message digest. Forthe purposes of this explanation, think of it as the value ofthe word count result, 500. The message digest (the 500 value)is then encrypted apart from the message itself, with a sender'sprivate key. Because only the sender has access to this privatekey, the result is a "digital fingerprint"-a uniquenumber that only the originator with a private key can createand which can only be decrypted with the companion public key.<P>Next, a new, random key is generated to encrypt the actual messageand the digital signature. The recipient will need a copy of thisrandom key in order to decrypt the message. This random key isthe only key in the world that can decrypt the message and itis solely in the possession of the sender. This means the randomkey must now be sent, maintaining its secrecy, to the recipient,so the message can be decrypted. To allow for secure sending ofthe random key, it too is encrypted, this time with the recipient'spublic key. The encrypted random key is referred to as the digitalenvelope. Only the recipient will be able to decrypt the randomkey since it was encrypted with his or her public key-and so onlyhis or her private key can decrypt it. <P>The result of this process is an encrypted confidential message,an encrypted signature, and the encrypted digital envelope. Whenthe recipient gets the message, he or she decrypts the digitalenvelope with the private key, which results in the random keyused to encrypt the message. The recipient then uses the randomkey to decrypt the actual message. However, at this stage thereis no way to check that the message hasn't been altered en route-orthat the message is authentic; that is, sent by the person itclaims to be sent by. The recipient now uses the sender's publickey to decrypt his or her encrypted digital signature. The recipientthen gets the message digest-the message's "digital fingerprint."<P>By running the digital fingerprint message through the same algorithm-thehash function-a new message digest is generated. If authentic,this new message digest should match the original message digestprecisely. If they don't match, either someone else composed themessage, or the message was altered by someone after it was written.<P>In the process described above, a public-key system was crucialto the flow. Private key (or secret key) cryptosystems are notfeasible to be used widely on the Internet or intranets for thingssuch as electronic commerce. For a company to conduct businessover the Internet or intranets with a private key system wouldmean creating millions of different private keys-one for eachperson who wanted to do business-and then figuring out some wayto send those private keys securely over the Internet, which isnot really possible. In secret key cryptography, only one keyis used to encrypt and decrypt messages. With a public-key system,a business only needs to create a single public/private key combination.The business would post the public key for anyone to use to encryptinformation-but only the business itself, with the private key,would be able to decrypt the data.<H2><A NAME="HowEncryptionWorks"><FONT SIZE=5 COLOR=#FF0000>How Encryption Works</FONT></A></H2><P>One means of securing an intranet is to use encryption-alteringdata so that only someone with access to specific decryption codescan understand the information. Encryption is used for storingand sending passwords to make sure that no snoopers can understandthem. Encryption is used as well when data is sent between intranetson Very Secure Private Networks (VSPNs). Encryption is also usedto conduct commerce on the Internet to protect credit card informationduring transmission.<OL><LI><I>Keys </I>are the heart of encryption. Keys are complexmathematical formulas (algorithms), that are used to encrypt anddecrypt messages. If someone encrypts a message, only someonewith the proper key will be able to decrypt the message. Thereare two basic key systems, secret-key and public-key cryptography.<LI>An algorithm is used to perform a hash function. This processproduces a message digest unique to the message. The message digestis encrypted with the sender's private key which results in adigital fingerprint.<LI>Data Encryption Standard (DES) is a secret-key (symmetric)system; there is no public key component. Both the sender andthe receiver know the secret code word. This method is not feasiblefor conducting business over the Internet.<LI>RSA is a public-key (asymmetric) system. RSA uses key pairsto encrypt and decrypt messages. Each person has a <I>public key,</I>available to anyone on a public key ring, and a <I>privatekey</I>, kept only on their computer. Data encrypted with someone'sprivate key can only be decrypted with their public key; and dataencrypted with their public key can only be decrypted with theirprivate key. Therefore, RSA requires an exchange of public keys;this can be done without a need for secrecy since the public keyis useless without the companion private key.<LI>PGP, Pretty Good Privacy, a program invented by Philip Zimmermann,is a popular method used to encrypt data. It uses MD5 (message-digest5) and RSA cryptosystems to generate the key pairs. PGP is a popularprogram that can run on UNIX, DOS, and Macintosh platforms. Itoffers some variations of functionality, like compression, thatother cryptosystems do not. Multiple key pairs can be generatedand placed on public and private key rings.</OL><H2><A NAME="HowCryptosystemsWork"><FONT SIZE=5 COLOR=#FF0000>How Cryptosystems Work</FONT></A></H2><P>Because of the open nature of the Internet, it is easy for peopleto intercept messages that travel across it-making it difficultto send confidential messages or financial data, such as creditcard in-formation. To solve the problem, cryptosystems have beendeveloped. A popular one, called RSA, uses keys to encrypt anddecrypt messages so that only the sender and receiver can understandthe messages. The system requires that each person have a publickey that is made available to anyone, and a private key that theykeep only on their computer. Data encrypted with someone's privatekey can only be decrypted with their private key. This illustrationis an example of how a public-key system works. In it, Gabrieland Mia want to exchange a confidential message. They have alreadyexchanged public keys. <UL><LI>Gabriel wants to send a confidential message over the Internetto Mia. Mia will need some way to decrypt the message-as wellas a way to guarantee that the message has been actually sentby Gabriel, and not by an imposter. First, Gabriel runs his messagethrough an algorithm called a<I> hash function.</I> This producesa number known as the<I> message digest.</I> The message digestacts as a sort of "digital fingerprint" that Mia willuse to ensure that no one has altered the message.<LI>Gabriel now uses his private key to encrypt the message disgest.This produces a unique digital signature that only he, with hisprivate key, could have created.<LI>Gabriel generates a new random key. He uses this key to encrypthis original message and his digital signature. Mia will needa copy of this random key in order to decrypt Gabriel's message.This random key is the only key in the world that can decryptthe message- and at this point only Gabriel has the key.<LI>Gabriel encrypts this new random key with Mia's public key.This encrypted random key is referred to as the<I> digital envelope.</I>Only Mia will be able to de-crypt the random key since it wasencrypted with her public key-and so only her private key candecrypt it.<LI>Gabriel sends a message over the Internet to Mia that is composedof several parts: the encrypted confidential message, the encrypteddigital signature, and the encrypted digtal envelope.<LI>Mia gets the message. She decrypts the digital envelope withher private key-and out of it gets the random key that Gabrielused to encrypt the message.<LI>Mia uses the random key to decrypt Gabriel's message. Shecan now read the confidential message that he sent her. She can'tyet be sure, however, that the message hasn't been altered enroute-or that the message was in fact sent by Gabriel.<LI>She now uses Gabriel's public key to decrypt his encrypteddigital signature. When she does this, she gets his message digest-the message's "digital fingerprint."<LI>Mia will use this message digest to see whether the messagewas in fact sent by Gabriel and not altered in any way. She takesthe message that she had decrypted and runs it through the samealgorithm-the hash function-that Gabriel ran the message through.This will produce a new message digest<LI>Mia compares the message digest that she calculated to theone that she got out of Gabriel's digital signature. If the twomatch precisely, she can be sure that Gabriel signed the messagethat it was not altered after he composed it. If they don't match,then she knows that either he didn't compose the message or thatsomeone altered the message after he wrote it.</UL><HR><CENTER><P><A HREF="ch16.htm"><IMG SRC="PC.GIF" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="#CONTENTS"><IMG SRC="CC.GIF" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="contents.htm"><IMG SRC="HB.GIF" BORDER=0 HEIGHT=88 WIDTH=140></A><A HREF="ch18.htm"><IMG SRC="NC.GIF" BORDER=0 HEIGHT=88 WIDTH=140></A><HR WIDTH="100%"></P></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -