⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 09-02.html

📁 Applied Cryptography
💻 HTML
📖 第 1 页 / 共 2 页
字号:
			<option value="/reference/dir.y2k1.html">Y2K			<option value="">-----------			<option value="/reference/whatsnew.html">New Titles			<option value="">-----------			<option value="/reference/dir.archive1.html">Free Archive					</SELECT>			</font></td>	</tr>	</table>	</form><!-- LEFT NAV SEARCH END -->		</td>		<!-- PUB PARTNERS END --><!-- END LEFT NAV --><td rowspan="8" align="right" valign="top"><img src="/images/iswbls.gif" width=1 height=400 alt="" border="0"></td><td><img src="/images/white.gif" width="5" height="1" alt="" border="0"></td><!-- end of ITK left NAV --><!-- begin main content --><td width="100%" valign="top" align="left"><!-- END SUB HEADER --><!--Begin Content Column --><FONT FACE="Arial,Helvetica" SIZE="-1">To access the contents, click the chapter and section titles.</FONT><P><B>Applied Cryptography, Second Edition: Protocols,  Algorthms, and Source Code in C (cloth)</B><FONT SIZE="-1"><BR><I>(Publisher: John Wiley & Sons, Inc.)</I><BR>Author(s): Bruce Schneier<BR>ISBN: 0471128457<BR>Publication Date: 01/01/96</FONT><P><form name="Search" method="GET" action="http://search.earthweb.com/search97/search_redir.cgi"><INPUT TYPE="hidden" NAME="Action" VALUE="Search"><INPUT TYPE="hidden" NAME="SearchPage" VALUE="http://search.earthweb.com/search97/samples/forms/srchdemo.htm"><INPUT TYPE="hidden" NAME="Collection" VALUE="ITK"><INPUT TYPE="hidden" NAME="ResultTemplate" VALUE="itk-full.hts"><INPUT TYPE="hidden" NAME="ViewTemplate" VALUE="view.hts"><font face="arial, helvetica" size=2><b>Search this book:</b></font><br><INPUT NAME="queryText" size=50 VALUE="">&nbsp;<input type="submit" name="submitbutton" value="Go!"><INPUT type=hidden NAME="section_on" VALUE="on"><INPUT type=hidden NAME="section" VALUE="http://www.itknowledge.com/reference/standard/0471128457/"></form><!-- Empty Reference Subhead --><!--ISBN=0471128457//--><!--TITLE=APPLIED CRYPTOGRAPHY, SECOND EDITION: Protocols, Algorithms, and Source Code in C//--><!--AUTHOR=Bruce Schneier//--><!--PUBLISHER=Wiley Computer Publishing//--><!--CHAPTER=09//--><!--PAGES=191-194//--><!--UNASSIGNED1//--><!--UNASSIGNED2//--><CENTER><TABLE BORDER><TR><TD><A HREF="09-01.html">Previous</A></TD><TD><A HREF="../ewtoc.html">Table of Contents</A></TD><TD><A HREF="09-03.html">Next</A></TD></TR></TABLE></CENTER><P><BR></P><P>To illustrate the problem, consider a money transfer system that moves money between accounts in different banks. To make life easier for the bank&#146;s computer systems, banks agree on a standard message format for money transfer that looks like this:</P><!-- CODE SNIP //--><PRE>     Bank One: Sending         1.5 blocks     Bank Two: Receiving       1.5 blocks     Depositor&#146;s Name          6 blocks     Depositor&#146;s Account       2 blocks     Amount of Deposit         1 block</PRE><!-- END CODE SNIP //--><P>A block corresponds to an 8-byte encryption block. The messages are encrypted using some block algorithm in ECB mode.</P><I><P><A NAME="Fig1"></A><A HREF="javascript:displayWindow('images/09-01.jpg',275,111 )"><IMG SRC="images/09-01t.jpg"></A><BR><A HREF="javascript:displayWindow('images/09-01.jpg',275,111)"><FONT COLOR="#000077"><B>Figure 9.1</B></FONT></A>&nbsp;&nbsp;Ciphertext stealing in ECB mode.</I></P><P>Mallory, who is listening on the communications line between two banks, Bank of Alice and Bank of Bob, can use this information to get rich. First, he sets up his computer to record all of the encrypted messages from Bank of Alice to Bank of Bob. Then, he transfers $100 from Bank of Alice to his account in Bank of Bob. Later, he does it again. Using his computer, he examines the recorded messages looking for a pair of identical messages. These messages are the ones authorizing the $100 transfers to his account. If he finds more than one pair of identical messages (which is most likely in real life), he does another money transfer and records those results. Eventually he can isolate the message that authorized his money transaction.</P><P>Now he can insert that message into the communications link at will. Every time he sends the message to Bank of Bob, another $100 will be credited to his account. When the two banks reconcile their transfers (probably at the end of the day), they will notice the phantom transfer authorizations; but if Mallory is clever, he will have already withdrawn the money and headed for some banana republic without extradition laws. And he probably did his scam with dollar amounts far larger than $100, and with lots of different banks.</P><P>At first glance, the banks could easily prevent this by adding a timestamp to their messages.</P><!-- CODE SNIP //--><PRE>    Date/Time Stamp:                1 block    Bank One: Sending               1.5 blocks    Bank Two: Receiving             1.5 blocks    Depositor&#146;s Name                6 blocks    Depositor&#146;s Account             2 blocks    Amount of Deposit               1 block</PRE><!-- END CODE SNIP //--><P>Two identical messages would be easy to spot using this system. Still, using a technique called <B>block replay</B>, Mallory can still get rich. Figure 9.2 shows that Mallory can pick out the eight ciphertext blocks that correspond to his own name and account number: blocks 5 through 12. A diabolical laugh is appropriate at this point, because Mallory is now ready.</P><P>He intercepts random messages from Bank of Alice to Bank of Bob and replaces blocks 5 through 12 in the message with the bytes that correspond to his name and account number. Then he sends them on to Bank of Bob. He doesn&#146;t have to know who the original depositor was; he doesn&#146;t even have to know what the amount was (although, he could correlate the messages he doctored with the various deposits into his account and determine the encrypted blocks corresponding to some dollar amount). He simply changes the name and account numbers to his own and watches his account balance grow. (I suppose Mallory has to be careful not to modify a withdrawal message, but assume for the moment that each is a different length or something.)</P><I><P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/09-02.jpg',360,74 )"><IMG SRC="images/09-02t.jpg"></A><BR><A HREF="javascript:displayWindow('images/09-02.jpg',360,74)"><FONT COLOR="#000077"><B>Figure 9.2</B></FONT></A>&nbsp;&nbsp;Encryption blocks for an example record.</I></P><P>This will take longer than a day for the banks to catch. When they reconcile their transfers at the end of the day, everything will match. It probably won&#146;t be until one of the legitimate depositors notices that his deposits are not being credited, or when someone flags unusual activity in Mallory&#146;s account, that the banks will figure out the scam. Mallory isn&#146;t stupid, and by then he will have closed his account, changed his name, and bought a villa in Argentina.</P><P>Banks can minimize the problem by changing their keys frequently, but this only means that Mallory is going to have to work more quickly. Adding a MAC, however, will also solve the problem. Even so, this is a fundamental problem with ECB mode. Mallory can remove, repeat, or interchange blocks at will. The solution is a technique called <B>chaining</B>.</P><H3><A NAME="Heading4"></A><FONT COLOR="#000077">9.3  Cipher Block Chaining Mode</FONT></H3><P>Chaining adds a <B>feedback</B> mechanism to a block cipher: The results of the encryption of previous blocks are fed back into the encryption of the current block. In other words, each block is used to modify the encryption of the next block. Each ciphertext block is dependent not just on the plaintext block that generated it but on all the previous plaintext blocks.</P><P>In <B>cipher block chaining</B> (<B>CBC</B>) mode, the plaintext is XORed with the previous ciphertext block before it is encrypted. Figure 9.3a shows CBC encryption in action. After a plaintext block is encrypted, the resulting ciphertext is also stored in a feedback register. Before the next plaintext block is encrypted, it is XORed with the feedback register to become the next input to the encrypting routine. The resulting ciphertext is again stored in the feedback register, to be XORed with the next plaintext block, and so on until the end of the message. The encryption of each block depends on all the previous blocks.</P><P>Decryption is just as straightforward (see Figure 9.3b). A ciphertext block is decrypted normally and also saved in a feedback register. After the next block is decrypted, it is XORed with the results of the feedback register. Then the next ciphertext block is stored in the feedback register, and so on, until the end of the message.</P><P>Mathematically, this looks like:</P><DL><DD><I>C</I><SUB>i</SUB> = <I>E</I><SUB>K</SUB>(<I>P</I><SUB>i</SUB>  &#8853; <I>C</I><SUB>i-1</SUB>)<DD><I>P</I><SUB>i</SUB> = <I>C</I><SUB>i-1</SUB> &#8853; <I>D</I><SUB>K</SUB>(<I>C</I><SUB>i</SUB>)</DL><I><P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/09-03.jpg',310,174 )"><IMG SRC="images/09-03t.jpg"></A><BR><A HREF="javascript:displayWindow('images/09-03.jpg',310,174)"><FONT COLOR="#000077"><B>Figure 9.3</B></FONT></A>&nbsp;&nbsp;Cipher block chaining mode.</I></P><P><FONT SIZE="+1"><B><I>Initialization Vector</I></B></FONT></P><P>CBC mode forces identical plaintext blocks to encrypt to different ciphertext blocks only when some previous plaintext block is different. Two identical messages will still encrypt to the same ciphertext. Even worse, two messages that begin the same will encrypt in the same way up to the first difference.</P><P><BR></P><CENTER><TABLE BORDER><TR><TD><A HREF="09-01.html">Previous</A></TD><TD><A HREF="../ewtoc.html">Table of Contents</A></TD><TD><A HREF="09-03.html">Next</A></TD></TR></TABLE></CENTER>[an error occurred while processing this directive]<!-- all of the reference materials (books) have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --><!-- BEGIN SUB FOOTER -->		<br><br>		</TD>    </TR>	</TABLE>			<table width="640" border=0 cellpadding=0 cellspacing=0>		<tr>		<td align="left" width=135><img src="/images/white.gif" width=100 height="1" alt="" border="0"></td>				<!-- END SUB FOOTER --><!-- all of the books have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --><!-- FOOTER -->					<td width="515" align="left" bgcolor="#FFFFFF"><font face="arial, helvetica" size="1"><b><a href="/products.html"><font color="#006666">Products</font></a>&nbsp;|&nbsp; <a href="/contactus.html"><font color="#006666">Contact Us</font></a>&nbsp;|&nbsp; <a href="/aboutus.html"><font color="#006666">About Us</font></a>&nbsp;|&nbsp; <a href="http://www.earthweb.com/corporate/privacy.html" target="_blank"><font color="#006666">Privacy</font></a> &nbsp;|&nbsp; <a href="http://www.itmarketer.com/" target="_blank"><font color="#006666">Ad Info</font></a> &nbsp;|&nbsp; <a href="/"><font color="#006666">Home</font></a></b>		<br><br>				Use of this site is subject to certain <a href="/agreement.html">Terms &amp; Conditions</a>, <a href="/copyright.html">Copyright &copy; 1996-1999 EarthWeb Inc.</a><br> All rights reserved.  Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.</font><p></td>		</tr></table></BODY></HTML><!-- END FOOTER -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -