<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Limited Entropy Dot Com &#187; Seguridad</title>
	<atom:link href="http://www.limited-entropy.com/category/seguridad/feed" rel="self" type="application/rss+xml" />
	<link>http://www.limited-entropy.com</link>
	<description>Not so random thoughts on security featured by Eloi Sanfèlix</description>
	<lastBuildDate>Mon, 05 Jul 2010 17:25:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Crypto Series: Mifare Crypto1</title>
		<link>http://www.limited-entropy.com/crypto-series-mifare-crypto1</link>
		<comments>http://www.limited-entropy.com/crypto-series-mifare-crypto1#comments</comments>
		<pubDate>Sun, 11 Oct 2009 19:00:06 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>
		<category><![CDATA[Crypto1]]></category>
		<category><![CDATA[Mifare]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=408</guid>
		<description><![CDATA[Let's go back into Cryptography. This time I'll tell you how the (in)famous Crypto1 cipher works. It is used in the Mifare Classic RFID tags, typically used for building access control but also for many other systems such as the Oyster Card in London, the OV-Chipkaar in The Netherlands, etc. We won't talk about the [...]]]></description>
			<content:encoded><![CDATA[<p>Let's go back into Cryptography. This time I'll tell you how the (in)famous Crypto1 cipher  works. It is used in the Mifare Classic RFID tags, typically used for building access control but also for many other systems such as the Oyster Card in London, the OV-Chipkaar in The Netherlands, etc.</p>
<p>We won't talk about the protocol details, nor about how the published attacks work. You'll find a couple of interesting links at the end though <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>Note: Images obtained from the  papers linked at the end of the post.</p>
<p><strong>The Crypto1 cipher</strong></p>
<p>Crypto1 is a proprietary stream chiper from NXP found in the RFID tags from the Mifare Classic family. At first, it was studied by Karsten Nohl reverse engineering the chip itself. This information was published in the CCC 07, although not many details about the cipher were published.</p>
<p>In parallel, the Radboud Universiteit from Nijmegen was studying this kind of cards and with the help of the information published at CCC completely reverse engineered the cipher and published the details. Let's see how it works then...</p>
<p><span id="more-408"></span></p>
<p>Crypto1 is an LFSR based cipher, which uses just an LFSR with a linear feedback function and a filter function to generate the output stream (<em>keystream</em>):</p>
<div id="attachment_415" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.limited-entropy.com/wp-content/uploads/2009/10/crypto1_overview.png"><img class="size-medium wp-image-415" title="Crypto1 - Overall structure" src="http://www.limited-entropy.com/wp-content/uploads/2009/10/crypto1_overview-300x158.png" alt="Crypto1 - Overall structure" width="300" height="158" /></a><p class="wp-caption-text">Crypto1 - Overall structure</p></div>
<p>The overall structure of the cipher was revealed in the presentation at CCC, but the generating polynomian (the feedback function used by the LFSR) and the filter function was not. The generating polynomial, published by Karsten Nohl et al at Usenix'08, is as follows:</p>
<img src='http://s.wordpress.com/latex.php?latex=g%28x%29%20%3D%20x%5E%7B48%7D%20%2B%20x%5E%7B43%7D%20%2B%20x%5E%7B39%7D%20%2B%20x%5E%7B38%7D%20%2B%20x%5E%7B36%7D%20%2B%20x%5E%7B34%7D%20%2B%20x%5E%7B33%7D%20%2B%20x%5E%7B31%7D%20%2B%20x%5E%7B29%7D%2Bx%5E%7B24%7D%20%2B%20x%5E%7B23%7D%20%2B%20x%5E%7B21%7D%20%2B%20x%5E%7B19%7D%20%2B%20x%5E%7B13%7D%20%2B%20x%5E9%20%2B%20x%5E7%20%2B%20x%5E6%20%2B%20x%5E5%20%2B%201%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='g(x) = x^{48} + x^{43} + x^{39} + x^{38} + x^{36} + x^{34} + x^{33} + x^{31} + x^{29}+x^{24} + x^{23} + x^{21} + x^{19} + x^{13} + x^9 + x^7 + x^6 + x^5 + 1 ' title='g(x) = x^{48} + x^{43} + x^{39} + x^{38} + x^{36} + x^{34} + x^{33} + x^{31} + x^{29}+x^{24} + x^{23} + x^{21} + x^{19} + x^{13} + x^9 + x^7 + x^6 + x^5 + 1 ' class='latex' />
<p style="text-align: left;">This means that bits 43,39,38...,7,6,5,0 are used to create the new bit that will be shifted into the register. Further, the input bit is used and a XOR of all them is executed to generated the next bit. This polynomial is <em>primitive</em>: irreducible and generates all the <img src='http://s.wordpress.com/latex.php?latex=2%5E%7B48%7D-1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2^{48}-1' title='2^{48}-1' class='latex' /> possible states before cycling back to the initial state.</p>
<p style="text-align: left;">On the other hand,the filter functions were published by the people from RU Nijmegen at Esorics'08. The following picture shows those filter functions together with the rest of the cipher.</p>
<p style="text-align: left;">
<div id="attachment_416" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.limited-entropy.com/wp-content/uploads/2009/10/crypto1.png"><img class="size-medium wp-image-416" title="Crypto1 - Detailed structure" src="http://www.limited-entropy.com/wp-content/uploads/2009/10/crypto1-300x75.png" alt="Crypto1 - Detailed structure" width="300" height="75" /></a><p class="wp-caption-text">Crypto1 - Detailed structure</p></div>
<p style="text-align: left;">Each of the hexadecimal numbers identifying the filter functions should be read as a bitmap where the left-most bit will be produced as an output of the filter function when the input was <em>all-ones</em> while the right-most bit will be produced as an output when the input was <em>all-zero</em>. For instance, 0x26c7 in binary form would be:</p>
<p style="text-align: center;">0010 0110 1100 0111</p>
<p style="text-align: left;">Which means that for inputs (1,1,1,1), (1,1,1,0), (1,1,0,0), (1,0,0,1), (0,1,1,0), (0,1,0,1)  and (0,1,0,0) the result of the filter function would be 0, and 1 otherwise.</p>
<p><strong>Links<br />
</strong></p>
<p>This completes the description of the Crypto1 cipher used by Mifare Classic chips. I don't want to get into more details about the structure of the cipher and the protocol, because I didn't look at it in depth amongst other reasons, so for more information you can follow these links:</p>
<p><a href="http://www.cs.virginia.edu/~evans/pubs/usenix08/usenix08.pdf">Reverse-Engineering a Cryptographic RFID Tag - Karsten Nohl et al. Usenix'08</a></p>
<p><a href="http://www.sos.cs.ru.nl/applications/rfid/2008-esorics.pdf">Dismantling MIFARE Classic - Flavio D. Garcia et al. (RU Nijmegen). Esorics'08</a></p>
<p><a href="http://www.cs.ru.nl/~erikpoll/hw/slides/2008-12-01%20Mifare%20Lecture.pdf">Lecture on Mifare Classic from HW and OS Security course at RU Nijmegen</a></p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-mifare-crypto1" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-mifare-crypto1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linear Feedback Shift Registers (LFSRs)</title>
		<link>http://www.limited-entropy.com/lfsrs</link>
		<comments>http://www.limited-entropy.com/lfsrs#comments</comments>
		<pubDate>Sun, 13 Sep 2009 18:16:56 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=389</guid>
		<description><![CDATA[In this post I'll provide a very simple description of linear feedback shift registers (LFSR for short). Further, we'll see how they are used to create stream ciphers. And all these things without going into mathematical details, for which I refer the interested reader to documents such as the Handbook of Applied Cryptography or this [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I'll provide a very simple description of linear feedback shift registers (LFSR for short). Further, we'll see how they are used to create <em>stream ciphers</em>. And all these things without going into mathematical details, for which I refer the interested reader to documents such as the <a href="http://www.cacr.math.uwaterloo.ca/hac/"><em>Handbook of Applied Cryptography</em></a> or this <a href="http://www.newwaveinstruments.com/resources/articles/m_sequence_linear_feedback_shift_register_lfsr.htm">LFSR Reference</a>.</p>
<p><strong>Shift Registers</strong></p>
<p>A shift register is basically a construction with interconnected several memory cells, where every cell stores one bit. So, the value of these cells conforms the so-called <em>state</em> of the register. When the register steps from one state to the next one (usually at each clock tick), the new state is created by simply shifting the bit in a cell to the cell next to it. Thus, the right-most bit <em>goes out</em> of the register, and a new bit <em>goes into</em> the left-most cell.</p>
<p>In this picture we can see an implementation of a 4 bit shift register:</p>
<div class="wp-caption aligncenter" style="width: 423px"><img title="Registro de desplazamiento" src="http://upload.wikimedia.org/wikipedia/commons/a/a1/4-Bit_SIPO_Shift_Register.png" alt="Registro de desplazamiento" width="413" height="141" /><p class="wp-caption-text">Shift register</p></div>
<p>We can see an input line (<em>Data in</em>), 4 points where one can read the current state (Q1-Q4) and a clock input, which governs the register telling it in which moment it should step into the next state.</p>
<p><strong>Linear Feedback Shift Registers (LFSRs)</strong></p>
<p>Well, once you know what a shift register is, it is fairly straightforward to understand how a LFSR works. We just take the previous register and set the input as a linear combination of the different cells. Since there is a loop which <em>feeds</em> the register based on its previous state, we have <em>feedback</em>. Further, since this feedback is based on a linear function, then we have <em>linear feedback</em>, hence the name <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<div class="wp-caption aligncenter" style="width: 476px"><a><img title="LFSR" src="http://www.newwaveinstruments.com/resources/articles/images/m_sequence_linear_feedback_shift_register_lfsr/Fibonacci_LFSR.gif" alt="LFSR" width="466" height="101" /></a><p class="wp-caption-text">LFSR</p></div>
<p><strong>LFSRs' use in cryptography</strong></p>
<p>So far, you probably have guessed that the main use of an LFSR in encryption systems is generating a series of <em>pseudo-random</em> bits to be used as a <em>key stream</em> in a stream cipher.</p>
<p>The idea is to generate a stream of bits with the minimum repetition possible, i.e. with maximal period. For its study, the connections in an LFSR are usually represented as a <em>polynomial</em> and the properties such a polynomial needs to meet to achieve maximal period are analyzed.</p>
<p>Basically, we need to get the LFSR to run through all its possible states before going back into the first one. So, if we have 16 bit registers, we'd want to have the LFSR pass through the 2^16-1 states before cycling back to the first one. And yes, I said 2^16-1 instead of 2^16 because the zero state should never appear. Otherwise the LFSR will never leave this state, since the feedback function is linear. For the curious readers, an LFSR will have maximal period if its <em>generating polynomial</em> is a so-called <em>primitive polynomial</em> (I'm pretty sure this name will ring a bell for some of you guys, although maybe not as a happy memory <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ).</p>
<p>Setting aside the study of these polynomials, which involves somewhat comlex maths (to my non-mathematician opinion <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' />  ), an LFSR by itself should not be used as a <em>key stream</em> generator because its properties make it fairly predictable. In fact, given an <em>n</em> bit LFSR, obtaining <em>2n</em> bits of its output it is possible to recover the <em>generating polynomial</em> and be able to decrypt any subsequent text.</p>
<p>Therefore, LFSRs are not directly used in crypto, but they are generally used in one of these modes:</p>
<ul>
<li>Nonlinear combination of LFSRs: the output from several LFSRs is combined in a non-linear fashion to obtain a key stream.</li>
<li>Nonlinear filter generator: the output is generated from a non-linear combination of the state.</li>
<li>Clock-controlled generators: In this mode, several LFSRs step based on some rules, instead of stepping for every clock cycle.</li>
</ul>
<p>With this kind of constructions it is possible to improve LFSR's properties for the creation of <em>secure</em> stream ciphers. And that's it for LFSRs from my side, for more information refer to these references:</p>
<p><a href="http://www.cacr.math.uwaterloo.ca/hac/"><em>Handbook of Applied Cryptography</em></a></p>
<p><a href="http://www.newwaveinstruments.com/resources/articles/m_sequence_linear_feedback_shift_register_lfsr.htm"> LFSR Reference</a></p>
<p><a href="http://en.wikipedia.org/wiki/Linear_feedback_shift_register">LFSR</a> @ <a href="http://en.wikipedia.org/">Wikipedia</a></p>
<p><strong><br />
</strong></p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/lfsrs" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/lfsrs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Introduction to stream ciphers</title>
		<link>http://www.limited-entropy.com/crypto-series-stream-ciphers</link>
		<comments>http://www.limited-entropy.com/crypto-series-stream-ciphers#comments</comments>
		<pubDate>Thu, 03 Sep 2009 21:30:21 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=371</guid>
		<description><![CDATA[Today we're gonna step a little further in our Crypto series. We'll see the main properties of the so-called Stream Ciphers, how they work and some things that should be taken into account when they are used. Later in this series, we'll see how Linear Feedback Shift Registes (LFSR) work and we'll see one of [...]]]></description>
			<content:encoded><![CDATA[<p>Today we're gonna step a little further in our Crypto series. We'll see the main properties of the so-called <em>Stream Ciphers</em>, how they work and some things that should be taken into account when they are used.</p>
<p>Later in this series, we'll see how Linear Feedback Shift Registes (LFSR) work and we'll see one of the most used stream ciphers, together with an example of wrong usage.</p>
<p>Keep on reading to learn more about this class of ciphers.</p>
<p><span id="more-371"></span></p>
<p><strong>General features</strong></p>
<p>As opposed to <a href="http://www.limited-entropy.com/en/crypto-series-block-ciphers">block ciphers</a>, a <strong>stream cipher</strong> does not divide the plaintext in <em>big</em> blocks where the cipher is applied, but instead it encrypts individual information elements such as bits, bytes or characters.</p>
<p>Generally, based on an <strong>initial key<em> </em></strong>a stream cipher <strong>derives </strong>a series of characters known as the <strong>key stream</strong> which is then mixed with the input data, or <strong>data stream</strong>, generally by means of an exclusive or operation.</p>
<p>This is based on the <em>One Time Pad (OTP)</em> concept, which we didn't mention earlier in this blog but most likely you have already heard of it. The OTP is a cryptographic algorithm which simply generates a random key as long as the message to be encrypted and mixes both, by means of a XOR operation in digital communications.</p>
<p>The properties of the OTP algorithm offer <em>absolute confidentiality</em> in the sense that the cryptogram does not reveal any information about the message contents, at the cost of a key as long as the message itself. Obviously, this makes key management not practical at all: where before we had the problem of sending a message of length L in a secure way, now we can send the encrypted message without any fear but still we need to send a key of length L... which leaves us with an equivalent problem!</p>
<p>Following this philosophy of using random keys as long as messages, the stream ciphers that we are analyzing today were invented. To that end, as I explained above, they try to derive a series of <em>pseudo-random</em> characters based on a secret key. This way, one obtains similar properties to the OTP algorithm reducing the complexity of key management... but of course this also reduces the randomness of the key stream.</p>
<p><strong>Stream cipher classification</strong></p>
<p>Stream ciphers are usually divided into two groups: synchronous and self-synchronizing stream ciphers. Most stream ciphers proposed so far are <strong>synchronous ciphers</strong>, where the <strong>keystream</strong> is generated <strong>independently of the plaintext and</strong> the <strong>ciphertext</strong>. Therefore, these ciphers require both ends of the communication to be sinchronized, and if a single digit of the cryptogram is lost the rest of the plaintext will be unrecoverable (unless error-correcting techniques are used).</p>
<p>Further, in these systems errors are not propagated besides one single character. This allows an active attacker to modify the contents of the ciphertext without detection. For instance, in a system as the one commented at the beginning, where a XOR of the <em>keystream</em> and the <em>data stream</em> is performed, one could just flip a bit in the decrypted plaintext by flipping the same bit in the cyphertext.</p>
<p>On the other hand, <strong>self-synchronizing ciphers</strong> generate a <strong>keystream dependant on the key and </strong>part of the previous <strong>ciphertext</strong>. Therefore, since a given character depends on the previous ciphertext character, if an error occurs it is possible to resynchronize after some time: we just need to discard as many characters as needed so that the keystream doesn't depend anymore on the corrupted ciphertext.</p>
<p><strong>Some security considerations</strong></p>
<p>It is extremely important in a stream cipher that the key stream does not frequently repeat, especially on those ciphers which use an additive function (i.e. XOR) to mix keystream and data stream. The reason is quite simple: if a given message is compromised but the key is not, any message that uses the same key stream could be compromised simply XORing the known keystream and the ciphertext.</p>
<p>Further, in case a message is not compromised but one obtains several messages encrypted with the same key stream, XORing both messages it is possible to remove the influence of the key stream: we would have the XOR of both initial plain texts. This way, we could possibly obtain information on the transmitted messages (structure, statistical properties, ...) that would help us to break the messages.</p>
<p>We could see an example of this method at Campus Party, where <em>Cucaracha</em> decrypted two ciphertexts encrypted using RC4 based on the knowledge that the language was Spanish and guessing the first message and applying the resulting key stream to the second message to see whether the output was sensible or not. It's completely logical, although requires a detailed work and I have to admit that at first I was shocked when he told me that he got the messages but not the key <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' /> </p>
<p>To avoid this kind of problems, normally an initialization vector (IV) is used to initiate the cipher and have a different keystream each time. Therefore, it is important that the IV is not reused very often.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-stream-ciphers" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-stream-ciphers/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Advanced Encryption Standard</title>
		<link>http://www.limited-entropy.com/crypto-series-aes</link>
		<comments>http://www.limited-entropy.com/crypto-series-aes#comments</comments>
		<pubDate>Sun, 28 Jun 2009 19:00:27 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>
		<category><![CDATA[Cryptography]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=300</guid>
		<description><![CDATA[Last time I wrote about the DES cipher, so today (yes, you guessed it) I'm writing about how the AES works. AES was created as a result of an open contest proposed by the NIST. In 1997, the NIST announced their wish to have a new encryption standard which would substitute the Data Encryption Standard [...]]]></description>
			<content:encoded><![CDATA[<p><p>Last time I wrote about the DES cipher, so today (yes, you guessed it) I'm writing about how the AES works. AES was created as a result of an open contest proposed by the NIST. In 1997, the NIST announced their wish to have a new encryption standard which would substitute the <a href="http://www.limited-entropy.com/en/crypto-series-block-ciphers-des"><em>Data Encryption Standard</em></a><em> </em>and was to be called AES: Advanced Encryption Standard.</p>
<p>Several researchers submitted their proposals to the AES contest, but the winning candidate was the so called Rijndael cipher. This cipher was originally created by two Belgian cryptographers,  <a title="Joan Daemen" href="http://en.wikipedia.org/wiki/Joan_Daemen">Joan Daemen</a> and <a title="Vincent Rijmen" href="http://en.wikipedia.org/wiki/Vincent_Rijmen">Vincent Rijmen</a>, who submitted it to the AES selection process.</p>
<p>The other finalists were <a href="http://www.schneier.com/twofish.html">Twofish</a> (<a href="http://www.schneier.com/">Bruce Schneier</a> and others), <a href="http://en.wikipedia.org/wiki/Serpent_(cipher)">Serpent</a> (<a href="http://www.cl.cam.ac.uk/~rja14/">Ross Anderson</a> and others), <a href="http://en.wikipedia.org/wiki/MARS_(cryptography)">MARS</a> (the team included <a title="Don Coppersmith" href="http://en.wikipedia.org/wiki/Don_Coppersmith">Don Coppersmit</a>) and <a href="http://en.wikipedia.org/wiki/RC6">RC6</a> (<a href="http://en.wikipedia.org/wiki/Ron_Rivest">Ron Rivest</a> [the R in RSA :-p ] and others).</p>
<p>After the contest, the NIST published AES as a FIPS standard, and since then the AES cipher has been extensively used and analyzed. In the remaining of this post we see how AES works, as we did with DES in the previous post.</p>
<p>NOTE: Just as in previous entry, images are taken from Wikipedia. Let me know if you try to read the post and they don't work anymore.</p>
<p><span id="more-300"></span><strong>AES Structure</strong></p>
<p>Again, we start by looking at the overall structure of the AES cipher. In the case of AES, the block size is 128 bits and the key size can be 128, 192 or 256 bits. The original Rijndael specification also supported several block sizes, but in the AES standard itself only 128 bits blocks are defined.</p>
<p>Just like with DES, the cipher consists of a basic operation called <em>round</em> which is repeated a number of times. In this case, AES is based in a design principle called <em>Substitution-Permutation Networks</em> which means that the cipher is composed of a series of substitutions and permutations one after each other.</p>
<p>The number of <em>rounds (R) </em>in AES depends on the key length: 10 rounds for 128, 12 rounds for 192 and 14 rounds for 256 bits. AES works on a structure known as <em>the AES state</em>, which is simply an arrangement of the block in a 4x4 matrix. Furthermore, most AES operations can be described as operations in the <img src='http://s.wordpress.com/latex.php?latex=GF%282%5E8%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='GF(2^8)' title='GF(2^8)' class='latex' /> finite field. This gives AES a quite neat algebraic description.</p>
<p>However, they can also seen as byte operations, and we'll look at it mainly as a byte operation, since we don't really want to get into math here (I promised you!). But if you really want to get deep into crypto, then you will certainly need to learn about finite fields. They get more important in public key crypto, where we actually use <em>difficult</em> mathematical problems to protect our data... but we'll get into that later.</p>
<p>The basic building blocks of the AES cipher are as follows:</p>
<ul>
<li>SubBytes - A non-linear substitution, the AES S-boxes</li>
<li>ShiftRows - Shifts the rows of the AES state (hence the name!)</li>
<li>MixColumn - Mixes columns of the AES state, making each result cell a combination of other cells</li>
<li>AddRoundKey - Mixes the input AES state with the current round key</li>
</ul>
<p>As you can see, like in DES we have S-boxes, we have transpositions (ShiftRows), a mixing operation (MixColumn) and an operation to mix the data and the key. An AES encryption consists of the following steps:</p>
<ol>
<li>Initial round:
<ul>
<li>AddRoundKey</li>
</ul>
</li>
<li>R-1 rounds:
<ul>
<li>SubBytes</li>
<li>ShiftRows</li>
<li>MixColumns</li>
<li>AddRoundKey</li>
</ul>
</li>
<li>Final round (without MixColumns):
<ul>
<li>SubBytes</li>
<li>ShiftRows</li>
<li>AddRoundKey</li>
</ul>
</li>
</ol>
<p>So, we have an initial AddRoundKey step, which mixes input data with the <em>0th</em> round key. Then, <em>R-1</em> (9,11 or 13) identical rounds take place, and at the end a final round is applied. Now we'll see a more detailed explanation of each of these round components.</p>
<p><strong>SubBytes</strong></p>
<p>As I already said, this is just a substitution table. In this case, we don't have 8 different substitutions as in DES but just one. For those who can understand it, this substitution table is actually an operation on the <img src='http://s.wordpress.com/latex.php?latex=GF%282%5E8%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='GF(2^8)' title='GF(2^8)' class='latex' /> field with irreducible polynomial <img src='http://s.wordpress.com/latex.php?latex=m%28x%29%20%3D%20x%5E8%20%2B%20x%5E4%20%2B%20x%5E3%20%2B%20x%20%2B%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m(x) = x^8 + x^4 + x^3 + x + 1' title='m(x) = x^8 + x^4 + x^3 + x + 1' class='latex' /> which finds the multiplicative inverse of the input byte and then applies an affine transformation.</p>
<p>For those of you who don't know anything about finite fields, let's look at a very basic example of a finite field: the set of integer numbers modulo 7 (i.e., numbers from 0 to 6). With this set of numbers, we can define an addition operation (just add modulo 7) and a product operation (multiply modulo 7), then we would have:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=3%2B5%20pmod%7B7%7D%20equiv%208%20pmod%7B7%7D%20equiv%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='3+5 pmod{7} equiv 8 pmod{7} equiv 1' title='3+5 pmod{7} equiv 8 pmod{7} equiv 1' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=2%20times%204%20pmod%7B7%7D%20equiv%208%20pmod%7B7%7D%20equiv%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2 times 4 pmod{7} equiv 8 pmod{7} equiv 1' title='2 times 4 pmod{7} equiv 8 pmod{7} equiv 1' class='latex' /></p>
<p>And now, we define the multiplicative inverse of a given member of the field, <img src='http://s.wordpress.com/latex.php?latex=x&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x' title='x' class='latex' />, as the member <img src='http://s.wordpress.com/latex.php?latex=x%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x^{-1}' title='x^{-1}' class='latex' /> such that <img src='http://s.wordpress.com/latex.php?latex=x%20times%20x%5E%7B-1%7D%20pmod%7B7%7D%20equiv%201&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='x times x^{-1} pmod{7} equiv 1' title='x times x^{-1} pmod{7} equiv 1' class='latex' />. So, from our previous example 4 is the multiplicative inverse of 2 modulo 7.</p>
<p>In the case of AES, the operations take place in the <img src='http://s.wordpress.com/latex.php?latex=GF%282%5E8%29%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='GF(2^8) ' title='GF(2^8) ' class='latex' /> field, but the idea is basically the same: we have an addition and a multiplication operation, and we find a number such that after multiplying it by the input number (in the field!) we get 1. I hope it's clear <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now, after taking the inverse (which can be done pretty fast with the <a href="http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm">extended version of Euclid's algorithm</a>), AES applies an affine transformation to avoid some kind of attacks. An affine transformation is just a construction which takes x as an input, and produces an output of the form a·x+b.</p>
<p>Don't worry, you don't really need to know these details, but it doesn't hurt to have some concept of what AES actually does <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>ShiftRows</strong></p>
<p>This operation just shifts the rows of the AES state. It's easier to see it with an image:</p>
<p style="text-align: left;">
<div class="wp-caption aligncenter" style="width: 490px"><img title="AES ShiftRows step" src="http://upload.wikimedia.org/wikipedia/commons/e/e3/AES-ShiftRows.png" alt="AES ShiftRows step" width="480" height="173" /><p class="wp-caption-text">AES&#39; ShiftRows step</p></div></p>
<p style="text-align: left;">So you can see how row zero remains intact, row one is shifted once to the left (and therefore the first element goes to the last position), row 2 two times and row 3 three times.</p>
<p style="text-align: left;"><strong>MixColumns</strong></p>
<p style="text-align: left;">This is another <em>mathematical operation</em> which can be seen in several forms. First, it can be seen as a multiplication by a polynomial modulo another polynomial (wow!). Second, it can be seen as a multiplication by an MDS matrix... or you can just think of it as a way of mixing several columns which is easier.</p>
<p style="text-align: left;">If you want to actually know what happens at this stage, look at the Wikipedia page for the <a href="http://en.wikipedia.org/wiki/Rijndael_mix_columns">Rijndael mix columns</a> operation.</p>
<p style="text-align: left;"><strong>AddRoundKey</strong></p>
<p style="text-align: left;">This is the simplest step, but an important one nonetheless... otherwise we wouldn't have any key involved so far! For each round, a round key of the same length as the input block (128 bits) is generated and transformed into the <em>state</em> form. Then, each byte of the current AES state is XORed with the corresponding byte of the key state.</p>
<p style="text-align: left;"><strong>AES Key schedule</strong></p>
<p style="text-align: left;">So far we've seen all the components of the AES cipher, but we don't know how to generate the round keys. This is done by a scheduling algorithm, which can be run beforehand or together with the cipher. Devices with the luxury of having plenty of memory will normally precompute the round keys, and small devices such as smart cards probably prefer to compute them on the fly because they lack memory space.</p>
<p style="text-align: left;">The components of the key schedule are:</p>
<ul>
<li>Rotate - Rotates a 32 bit word 8 bits to the left</li>
<li>Rcon - A round dependent constant, which can also be defined as a certain power of two in Rijndael's finite field</li>
<li>SubBytes - The same SubBytes as in the main cipher</li>
</ul>
<p>The key schedule algorithm steps are quite large and I do not want to write them down here. You can find them in the standard or in the corresponding wikipedia page: <a href="http://en.wikipedia.org/wiki/Rijndael_key_schedule">Rijndael key schedule</a>.</p>
<p><strong>AES Decryption</strong></p>
<p>In this case, decryption is not as easy as for DES. Decryption involves performing the inverse operations of the ones performed for encryption, which means that one needs to define the inverse operations for ShiftRows, SubBytes and MixColumns. AddRoundKey does not need an inverse since it is already its own inverse.</p>
<p>Obviously, all these operations are also defined in the standard, and you can take a look at it to know how they are defined.</p></p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-aes" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-aes/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Block Ciphers &#8211; Data Encryption Standard (DES)</title>
		<link>http://www.limited-entropy.com/crypto-series-block-ciphers-des</link>
		<comments>http://www.limited-entropy.com/crypto-series-block-ciphers-des#comments</comments>
		<pubDate>Tue, 23 Jun 2009 19:12:33 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=273</guid>
		<description><![CDATA[The Data Encryption Standard ( DES ) was designed by IBM in 1973 as a submit for a call for proposals by the National Bureau of Standards of the United States.  There was some controversy regarding to the involvement of the NSA in the development of the cipher, especially to the mysterious S-boxes and the [...]]]></description>
			<content:encoded><![CDATA[<p>The Data Encryption Standard ( DES ) was designed by IBM in 1973 as a submit for a call for proposals by the National Bureau of Standards of the United States.  There was some controversy regarding to the involvement of the NSA in the development of the cipher, especially to the <em>mysterious</em> S-boxes and the reduced key size used, but years later it was shown that the S-boxes used where more resistant to Differential Cryptanalysis than if they had been selected at random.</p>
<p>The algorithm was approved as a FIPS standard in 1976, and revised up to three times in 1988,1993 and 1999. The last revision FIPS-46-3 describes the 3DES extension as a method to enlarge the key size of the DES cipher by using 3 DES operations in a row, encrypting the first time, decrypting the second time, and encrypting again the third time. This was done in order to withstand an efficient brute force attack published in 1998.</p>
<p>After the break (click <em>Read more!</em>) we'll see how it works and the main components of the algorithm.</p>
<p>NOTE: All images in this post are directly linked to Wikipedia. If the images are not visible anymore, let me know in the comments and I'll post my own version of the images.<span id="more-273"></span></p>
<p><strong>DES structure</strong></p>
<p>DES is a block cipher which encrypts 64 bits blocks under a 56 bits key. Actually, normally one supplies the DES algorithm with a 64 bits key, but the lowest significant bit of each key byte is not used for the encryption and could be used for parity checking.</p>
<p>The overall structure of DES is depicted in the following figure:</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 394px"><img title="DES structure" src="http://upload.wikimedia.org/wikipedia/commons/6/6a/DES-main-network.png" alt="DES structure" width="384" height="1035" /><p class="wp-caption-text">DES structure</p></div></p>
<p>It starts by applying the so called Initial Permutation (IP), which obviously performs a permutation, i.e. scrambles the input bits. Then the data block is divided into the upper 32 bits (L0) and the lower 32 bits (Ro) creating a left and a right part. Now 16 identical rounds are applied: a function <strong>F (Feistel's function)</strong> is applied to the right half and a <strong>round key</strong>, and the result is XORed with the left half. Then both halves are swapped.</p>
<p>After the 16 rounds have been applied, a Final Permutation (FP) is applied. This permutation is actually the inverse of the Initial Permutation ( <img src='http://s.wordpress.com/latex.php?latex=FP%20%3D%20IP%5E%7B-1%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='FP = IP^{-1}' title='FP = IP^{-1}' class='latex' /> ). All these things together conform what we call a Feistel's network, with a great property: we can decrypt the ciphertext with the same algorithm, changing only the order in which we apply the round keys.</p>
<p>This means that the decryption process for DES is identical to the encryption process. Only that round key 16 is applied first, then round key 15, and so on.</p>
<p><strong>The F function</strong></p>
<p>The F function is at the very core of the DES cipher. As explained above, this function is applied in each round to the right half and the round key, and its output is XORed with the left half. At the beginning of the F function, there is an <strong>Expansion function</strong> (<em><strong>E</strong></em>), which expands the 32 bits input into 48 bits. These 48 bits are then XORed with the 48 bits round key coming from the key scheduling algorithm.</p>
<p>Then, these 48 bits are supplied in groups of 6 bits to the S-boxes. The S-boxes are just substitution functions, which are implemented as a substitution table, and output 4 bits each one. Therefore, the output of the 8 S-boxes is again 32 bits, same size as the input and output of the F function. After the S-boxes, a permutation, P, is applied. The output of the permutation is the result of the F function.</p>
<div class="wp-caption aligncenter" style="width: 394px"><img title="Feistels function" src="http://upload.wikimedia.org/wikipedia/commons/a/a3/DES-f-function.png" alt="Feistels function" width="384" height="370" /><p class="wp-caption-text">Feistel&#39;s function</p></div>
<p><strong></strong></p>
<p><strong></strong></p>
<p><strong>Key Scheduling</strong></p>
<p>In order to have the complete picture of how DES works, we still need to know how the <em>round keys</em> are computed from the DES key. This is done by the so-called key scheduling algorithm, which can be run in parallel with the DES cipher or precomputed and stored in a table of round keys.</p>
<p>The process looks like this:</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 190px"><img title="DES key schedule" src="http://upload.wikimedia.org/wikipedia/commons/0/06/DES-key-schedule.png" alt="DES key schedule" width="180" height="295" /><p class="wp-caption-text">DES key schedule</p></div>
<p style="text-align: left;">First, a permutation PC1 is performed. The name comes from <em>Permuted Choice</em>, due to the fact that this permutation also <em>choses</em> some bits from the key: the last bit of each byte (i.e, bits 8,16, etc) is discarded as we said earlier, and the rest are used for the permutation.</p>
<p style="text-align: left;">After this, the structure is repeated for each round key: the result of applying PC1 is divided into left and right halves, these halves are shifted (cyclically) one or two bits to the left depending on the round number. After that, the shifted key is fed to a second permutation, PC2, which selects 48 bits out of the 56 input bits.</p>
<p style="text-align: left;"><strong>Detailed information</strong></p>
<p style="text-align: left;">So far, we've seen how DES works. However, you wouldn't be able to implement the DES algorithm without knowing exactly how permutations, expansion functions and S-boxes actually modify the data. To that end, you can go to the standard itself or to the <a href="http://en.wikipedia.org/wiki/DES_supplementary_material">DES Supplementary material</a> page on Wikipedia.</p>
<p style="text-align: left;">As usual, implementing your own crypto is not recommended. Do it only for educational purposes, otherwise things could easily go VERY wrong.</p>
<p><strong>Triple DES</strong></p>
<p>As explained in the introduction of this article, a brute force attack to DES was presented long ago. This attack motivated the introduction of a new variant of DES. This variant, called <em>triple DES</em>, uses three DES operations in a row to enlarge the key space.</p>
<p style="text-align: left;">Typically the data is DES encrypted with key K1, then decrypted with key K2, and then encrypted again with key K1. This raises the key length to 112 bits (8 bits of K1 and 8 bits of K2 are discarded by PC1), which makes a brute force attack much more difficult.</p>
<p style="text-align: left;">There exists also a 3DES variant which uses three different keys, achieving a key size of 168 bits. Of course, 3DES can also be used with 3 identical keys. This would give you a DES encryption and allow devices that do not implement 3DES to be used together with devices that implement 3DES.</p></p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-block-ciphers-des" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-block-ciphers-des/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Block ciphers</title>
		<link>http://www.limited-entropy.com/crypto-series-block-ciphers</link>
		<comments>http://www.limited-entropy.com/crypto-series-block-ciphers#comments</comments>
		<pubDate>Mon, 15 Jun 2009 06:00:40 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=279</guid>
		<description><![CDATA[In this entry we introduce block ciphers in a general way, as well as its modes of operation. Further, we'll see how to generate message authentication codes (MAC) using block ciphers. Block ciphers As we already said in the previous entry, block ciphers are symmetric ciphers which encrypt fixed length blocks. Therefore, a block cipher [...]]]></description>
			<content:encoded><![CDATA[<p>In this entry we introduce block ciphers in a general way, as well as its modes of operation. Further, we'll see how to generate message authentication codes (MAC) using block ciphers.</p>
<p><strong>Block ciphers</strong></p>
<p>As we already said in the <a href="http://www.limited-entropy.com/crypto-series-intro-modren-cryptography">previous entry</a>, block ciphers are <strong>symmetric ciphers</strong> which encrypt <strong>fixed length blocks</strong>. Therefore, a block cipher generally applies a series of operations combining the input block and the secret key (which isn't necessarily the same length) to obtain the output block (ciphertext).</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=c%3DE_K%28m%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c=E_K(m)' title='c=E_K(m)' class='latex' /></p>
<p>Since they are symmetric, the decryption primitive uses the same key as the encryption primitive, and applies the operations needed to get back the plaintext at its output:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=m%5Eprime%3DE%5E%7B-1%7D_K%28E_K%28m%29%29%3Dm%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m^prime=E^{-1}_K(E_K(m))=m ' title='m^prime=E^{-1}_K(E_K(m))=m ' class='latex' /></p>
<p style="text-align: left;">Most block ciphers can be classified as <em>product ciphers </em>or <em>iterative block ciphers</em>, based on a series of basic operations (<em>rounds</em>) which are repeated a number of times. These <em>rounds</em> provide <em>confusion</em> and <em>difusion</em> to the cipher, two concepts identified by <a href="http://en.wikipedia.org/wiki/Claude_Elwood_Shannon"><em>Shannon</em></a> in his famous treaty about communication theory.</p>
<p style="text-align: left;"><em>Confusion</em> refers to breaking the relationship between ciphertext and key as much as possible, while <em>diffusion</em> refers to destroying the statistical characteristics of the message source. Shannon identified these concepts and established the need for a secure cipher to provide them.</p>
<p>These kind of ciphers are generally Substitution-Permutation Networks (SPN), where several permutations (scrambling) and substitutions (changing values for others) take place one after the other, using a key, trying to achieve the goal: destroy the statistical properties of the source and obtain a secure cipher.</p>
<p style="text-align: left;">In subsequent entries we'll see how DES and AES, two well-known symmetric encryption standards, work. The remaining of this article treats block cipher modes of operation and how to authenticate messages using these ciphers.</p>
<p><span id="more-279"></span><strong>Modes of operation</strong></p>
<p>We'll see now some constructions that allow the use of a block cipher to encrypt texts larger than the block length. Some of them can be viewed as <em>stream ciphers</em> in which a <em>key stream</em> is generated and gets mixed with the plaintext.</p>
<p>First, we'll see the most simple way of using a block cipher. The construction that would come to every mind would be dividing the plaintext in blocks of the suitable length and encrypt each of them. This is what we call <strong>Electronic Codebook Mode (ECB)</strong>, and as can easily be observed, it mantains the structure of the plaintext at the block level (not inside blocks): two identical blocks produce the same ciphertext under the same key.</p>
<p>After ECB, one of the most famous modes is the <strong>Cipher Block Chaining (CBC)</strong>. In this case, the plaintext is also divided into several blocks, but before encrypting them with the secret key, they are XORed with the previous ciphertext block:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=c_i%20%3D%20E_K%28m_i%20oplus%20c_%7Bi-1%7D%29%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_i = E_K(m_i oplus c_{i-1}) ' title='c_i = E_K(m_i oplus c_{i-1}) ' class='latex' /></p>
<p style="text-align: left;">Where <img src='http://s.wordpress.com/latex.php?latex=c_0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_0' title='c_0' class='latex' /> would be the so called <em>Intialization Vector (IV)</em>, which can be different each time but doesn't need to be secret. Actually, it's usually known, either being a fixed value defined in the concrete protocol's specifications or sent together with the message as a header.</p>
<p style="text-align: left;">In this way, each encrypted block depends on each one of the previous blocks. A simple bit change in one of the blocks would produce a cascade effect and make the remaining blocks completely different. Clearly, message structure at the block level is not revealed. This is well illustrated in the following image from Wikipedia:</p>
<div class="wp-caption aligncenter" style="width: 206px"><img title="TuX cifrado en modo ECB" src="http://upload.wikimedia.org/wikipedia/commons/f/f0/Tux_ecb.jpg" alt="TuX cifrado en modo ECB" width="196" height="216" /><p class="wp-caption-text">TuX encrypted using ECB</p></div><br />
<div class="wp-caption aligncenter" style="width: 206px"><img title="TuX cifrado usando un modo seguro" src="http://upload.wikimedia.org/wikipedia/commons/a/a0/Tux_secure.jpg" alt="TuX cifrado usando un modo seguro" width="196" height="216" /><p class="wp-caption-text">TuX encrypted using a secure cipher</p></div>
<p>But not only CBC exists. For instance, the <strong>Output Feedback Mode (OFB)</strong> generates a bit stream to be used as a key, in the most pure stream cipher style. The cipher is initialized with an IV in the same way as CBC, but it is encrypted using the secret key. The resulting block has the <em>k</em> initial bits of key stream, which are XORed with the plaintext to produce the ciphertext.</p>
<p>To generate the next <em>keystream</em> bits, the previous block is used. Using the usual notation:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=O_0%3DIV&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='O_0=IV' title='O_0=IV' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=O_i%20%3D%20E_K%28O_%7Bi-1%7D%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='O_i = E_K(O_{i-1})' title='O_i = E_K(O_{i-1})' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=c_i%20%3D%20m_i%20oplus%20O_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_i = m_i oplus O_i' title='c_i = m_i oplus O_i' class='latex' /></p>
<p style="text-align: left;">Obviously, decryption will be performed calculating the same <em>keystream</em> and XORing it with the ciphertext. This construction creates a <em>stream cipher</em>, and as other stream ciphers, if one bit is flipped in the plaintext, it will also be flipped in the ciphertext (and the other way around) due to the usage of XOR.</p>
<p style="text-align: left;">Another quite common mode is the counter mode (<strong>CTR)</strong>, in which a counter is used at the input of the block cipher, and the output is used in the same mode as in <strong>OFB </strong>mode.</p>
<p style="text-align: left;">These are not all the existing modes, but the intention is simply to provide an overview of the options and to refer the interested reader to other sources. See for instance the famous <em>Applied Cryptography</em> from Bruce Schneier, or the <a href="http://www.cacr.math.uwaterloo.ca/hac/"><em>Handbook of Applied Cryptography</em></a><em>.</em></p>
<p><strong>Message Authentication Codes</strong></p>
<p>One of the problems that Cryptography's tried to solve, is the authentication of the data origin. This is, trying to assure that a message has been actually created by a certain person, machine or, more in general, entity. The solution to this problem based using symmetric crypto is known as <strong><em>Message Authentication Codes, </em></strong><em>or</em><strong><em> MACs</em></strong>.</p>
<p>These codes are just a block of groups generated by some alrogithm using a secret key and a plaintext message. The most common construction for generating these codes is based on using a block cipher in CBC mode, but taking just the last block as the MAC.</p>
<p>As we've seen previously, this last block depends on all the previous blocks, as well as on the key. Therefore, this code is binded to the complete message (provides <em>message integrity</em>) as well as to the entity with whom the secret key is shared (provides data origin authentication).</p>
<p>Thus, the receiver of the message, who shares a secret key with the source, is able to check whether the message was actually generated by the expected entity and that it has not been altered.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-block-ciphers" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-block-ciphers/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Introduction to Cryptool</title>
		<link>http://www.limited-entropy.com/crypto-series-introduction-to-cryptool</link>
		<comments>http://www.limited-entropy.com/crypto-series-introduction-to-cryptool#comments</comments>
		<pubDate>Tue, 02 Jun 2009 05:45:03 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=233</guid>
		<description><![CDATA[In this post we'll see some of the options provided by Cryptool to analyze classical ciphers, as well as using it for breaking a ciphertext encrypted with Vigenère's cryptosystem. First step, as usual, consists of installing Cryptool. To that end, I chose using a virtual machine in VMWare with Windows XP. The installation is very [...]]]></description>
			<content:encoded><![CDATA[<p><p>In this post we'll see some of the options provided by <a href="http://www.cryptool.com/">Cryptool</a> to analyze classical ciphers, as well as using it for breaking a ciphertext encrypted with Vigenère's cryptosystem.</p>
<p>First step, as usual, consists of installing <a href="http://www.cryptool.com/">Cryptool</a>. To that end, I chose using a virtual machine in VMWare with Windows XP. The installation is very simple, typical Windows app installation: Next, Next,... We'll use the English version, which is the one I have installed, but it shouldn't be difficult to follow our steps with a different version.</p>
<p>Once installed, this is how the main window of <a href="http://www.cryptool.com/">Cryptool</a> looks like:</p>
<div id="attachment_258" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.limited-entropy.com/wp-content/uploads/2009/06/cryptool.png"><img class="size-medium wp-image-258" title="Cryptool's main window" src="http://www.limited-entropy.com/wp-content/uploads/2009/06/cryptool-300x212.png" alt="Cryptool's main window" width="300" height="212" /></a><p class="wp-caption-text">Cryptool&#39;s main window</p></div>
<p>Looking at the menus, one can see that Cryptool offers (amongst others) the possibility to encrypt and decrypt texts, cryptanalytic tools and guided tutorials. In this text we'll see how to use Cryptool for analyzing encrypted texts... Let's start with an easy one:</p>
<blockquote><p>Gznyrém xlmlxrwz xlnl Fmrevihrwzw Klorgéxmrxz wv Ezovmxrz, l vo<br />
Klor kziz olh znrtlh, vh fm lhxfil oftzi oovml wv vhgfwrl b kvievihróm.<br />
Hlyivglwl, klijfv glwl zjféo ol hfurxrvmgvnvmgv olxl xlnl kziz vmgizi<br />
vm vooz, gvmwiá jfv szxvi zotl wv ol zmgvirlinvmgv xrgzwl kziz hzori<br />
zrilhl wv vooz. Vmgiv olh oftzivh náh xlmxfiirwlh, hv vmxfvmgizm oz<br />
Xzhz wvo Zofnml (szyrgfzonvmgv fhzwz kziz wlinri olh qfvevh wv<br />
nzwiftzwz, kvil gznyrém kziz qftzi z yroozi l ufgyloím, zfmjfv mlh<br />
jfrgzm vhgv vm éklxz wv vcánvmvh), oz Yryorlgvxz (wlmwv oz tvmgv hv<br />
wrervigv vhgfwrzmwl), b ozh krhgzh wv gvmrh b káwvo.</p>
</blockquote>
<p>The text has been obtained from <a href="http://www.upv.es/ieee">IEEE</a>'s <a href="http://www.ieee.upv.es/cripto/concurso.php">cryptography</a><a href="http://www.ieee.upv.es/cripto/concurso.php"> challenge</a>, by <a href="http://vierito.es/wordpress">Javi Moreno</a> and <a href="http://www.mapetitemort.com">Amine Tourisa</a> (sorry, Spanish). Actually, the solution was already published in <a href="http://vierito.es/wordpress">Javi</a>'s blog, but we're gonna see how to obtain it with Cryptool:</p>
<ul>
<li>Create a new document ( File | New )</li>
<li>Copy the text from the challenge</li>
<li>Go to <em>Analysis | Tools for Analysis | Histogram</em></li>
</ul>
<p>Now we get the following frequency diagram from the text:</p>
<div id="attachment_257" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.limited-entropy.com/wp-content/uploads/2009/06/histogram.png"><img class="size-medium wp-image-257" title="Frequency analysis of the ciphertext" src="http://www.limited-entropy.com/wp-content/uploads/2009/06/histogram-300x116.png" alt="Frequency analysis of the ciphertext" width="300" height="116" /></a><p class="wp-caption-text">Frequency analysis of the ciphertext</p></div>
<p>Next we just compare this diagram with the typical one from Spanish or English, and we can see that it's simply been 'mirrored'... easy, isn't it? So the answer is, as you probably guessed, ATBASH. Decrypting the text with ATBASH (<em>Crypt/Decrypt | Symmetric (Classic) | Substitution/Atbash ... ) </em>, we get this cleartext (again, Spanish):</p>
<blockquote><p><code>También conocida como Universidad Politécnica de Valencia, o el Poli para los amigos, es un oscuro lugar lleno de estudio y perversión. Sobretodo, porque todo aquél lo suficientemente loco como para entrar en ella, tendrá que hacer algo de lo anteriormente citado para salir airoso de ella. Entre los lugares más concurridos, se encuentran la Casa del Alumno (habitualmente usada para dormir los jueves de madrugada, pero también para jugar a billar o futbolín, aunque nos quitan este en época de exámenes), la Biblioteca (donde la gente se divierte estudiando), y las pistas de tenis y pádel.</code></p>
</blockquote>
<p>Now we'll see how to solve a Vigenère encrypted text. Let's take as our working example the following text:</p>
<p><span id="more-233"></span></p>
<blockquote><p>Yyi plqqsjiw icd rfwx vcrynevh ozi fxlhf bwrgxlqmq nsvng mwv hivwssvh<br />
xr hmpv eadm ktlv jusqifq xr gtfii eqr omrrkh htj nsvng.  Nd tsrwfmxk,<br />
xlh UZZ Xirhfmq Gyfowo Qzgiqgq nj mrwszivh xr ugfierwsq dfyv ifqjusq wc<br />
emrvi dbp hyerjs mqc ziugutew si o bwfkvda--ft deoh ggwv mx usyfzrw ifqj<br />
jsjwkmwv jsu oxq zxw xgqwj.  Ai, wvq Kiii Vcrynevh Tazehewwas, lwi wvq<br />
LEY Khbqwrp Txpxnt Pmfszxv jsu aaxk sj rid xfjxzodj; zx esdxnvw eoga yf<br />
erb cfmvv arfw wvpidgqi klmv kmd sc mwg mzklsug.  Ktl geq obucc mw ha<br />
dfyv sfalieqv, hat.</p>
<p>Nliq kq xgien cr kiii vcrynevh, kq fii vhtqwimrj ha kiiigcy, sfx<br />
tuwoj.  Fyv Jszjiep Sinqzg Plqqsjiw dfq ivwmjbqi ks qdyq xlvi wvmy psy<br />
kohj kli ifqjusq wc pnjxvlpgyv gsswqx fj jusq xfjxzodj (rrh fvmwxi jrf<br />
fmvq mi maz nmwk), htfk csx fqhvmzh gazigi fcpj fv gdb sjk mx lt ktl<br />
aeqh uy, klew maz ter fvmsxi xks etwxadfq ti ywh dujtiw rt uy zr rhk<br />
rwvi tucswrqw, dbp yyex bcg pesa bcg hrr hr htjji xkwzlj.</p>
<p>Xs sfayvgx bcgw imkkhe, bv rihr ft gviyszy fxlhfe kisq gszdzrk bcg<br />
yyiwh fulyxw rf mxbmrj maz ks wxfdjehiu htj imkkhe.  Yyivhtawv, csx vmav<br />
giuhmne vivdasjmflzuyziw lt ktl hmvhdnsyxh qauziw rt fmv wsihifii, su wr<br />
dfy qrrukp mx: useufrwlpuqzxmhg ft iiwssoy kli ifqjusq rt ayyivv.</p>
</blockquote>
<p>Again, we create a new document in Cryptool and paste the text in. Now we go to <em>Analyze | Symmetric Encryption (Classic) | Ciphertext-Ony | Vigenere.</em></p>
<p>After doing so, Cryptool will suggest a key length, and when we accept, it will tell us the key and allow us to decrypt the complete text, this time in English. We can also choose to see every step, with the <em>Show base ciphers analysis</em> option in <em>Options | Analysis Options</em>.</p>
<p>Further, Cryptool's output offers a plot with the text's autocorrelation, with periodic peaks in multiples of the key length <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  This is the tool used by Cryptool to analyze Vigenère's cryptograms, and we can also find it directly available in <em>Analyze | Manual | Autocorrelation</em>. This tool can be used to analyze texts and decide whether it could be a Vigenère (or similar) cipher or not.</p>
<p>That's it for today, I recommend you to keep on playing with Cryptool and to take a look at its <a href="http://www.cryptool.com/index.php/es/presentations-documentationmenu-50.html">official documentation</a>.</p></p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-introduction-to-cryptool" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-introduction-to-cryptool/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Crypto Series: WWII &#8211; Enigma</title>
		<link>http://www.limited-entropy.com/crypto-series-wwii-enigma</link>
		<comments>http://www.limited-entropy.com/crypto-series-wwii-enigma#comments</comments>
		<pubDate>Wed, 15 Apr 2009 06:00:54 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=221</guid>
		<description><![CDATA[With this post we're leaving classical pencil and paper ciphers and getting into the mechanic ciphers used during the World War II era. We're gonna see the most famous of the cipher machins, the Enigma machine used by the Germans. Our analysis will be based on the book Applied Cryptanalysis from Mark Stamp and Richard [...]]]></description>
			<content:encoded><![CDATA[<p>With this post we're leaving classical <em>pencil and paper </em>ciphers and getting into the mechanic ciphers used during the World War II era. We're gonna see the most famous of the cipher machins, the Enigma machine used by the Germans. Our analysis will be based on the book <a href="http://www.amazon.com/Applied-Cryptanalysis-Breaking-Ciphers-World/dp/047011486X">Applied Cryptanalysis</a> from <a href="http://cs.sjsu.edu/faculty/stamp/">Mark Stamp</a> and Richard M. Low. A very recommendable book if you are interested on cryptanalysis, really.</p>
<h1><strong>The Enigma Machine</p>
<p></strong></h1>
<p><strong></p>
<p></strong></p>
<p>The Enigma machine was developoed and patented by <a href="http://en.wikipedia.org/wiki/Arthur_Scherbius">Arthur Scherbius</a> in 1918, and was adopted by the nazi Germany for military and diplomacy use. Polish cryptanalysts broke the Enigma cipher in the late 1930s, and Allieds exploited this knowledge during WWII.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img title="Máquina Enigma" src="http://upload.wikimedia.org/wikipedia/commons/a/ae/Enigma.jpg" alt="Máquina Enigma" width="450" height="600" /><p class="wp-caption-text">Máquina Enigma</p></div>
<p>It is said that thanks to Enigma being broken without the Germans noticing it (thanks to the more or less careful use of the obtained intelligence) the WWII was shortend one year or even more. There has been a lot of writing around Enigma, and I'm not an expert in the field, so I refer you to Google if you want more historical information <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Encrypting and decrypting with Enigma</strong></p>
<p>To encrypt with Enigma, after initializing the machine with the key as we'll see later, one simply had to press the plaintext letter to encrypt in the keyboard, and then the corresponding ciphertext letter would be enlightened in the upper (back-lighted) keyboard.</p>
<p>To decrypt, one had to set the machine into the corresponding state and press the received ciphertext letter. Then, in the upper keyboard the plaintext letter would get enlightened.</p>
<p><strong>Enigma's features</p>
<p></strong></p>
<p>Enigma was an electro-mechanical machine, based on the use of <em>rotors</em>. In the previous figure, one can easily see the mechanical keyboard and the back-lighted keyboard, which worked as input and output of the device.</p>
<p>Further, there is what seems to be a switchboard (<em>stekker </em>in German) with cables connecting one of the ends with another, and three <em>rotors</em> in the upper side of the machine. The configuration of these rotors and the cables of the <em>stekker</em> are the initial key of the machine.</p>
<p>Once the machine was initialized, it was possible to press in the keyboard the plaintext or ciphertext letters and obtain the ciphertext or the plaintext respectively. The workings of the machine were essantially as follows:</p>
<p>After pressing a key in the keyboard, a signal was sent through the corresponding <em>stekker</em> pin. Thanks to the cable configuration, this signal was transmitted to a different letter. Thus, the <em>stekker</em> worked as a <em>mapping </em>in the alphabet, where each letter was substituted by another one: a simple substitution.</p>
<div class="wp-caption aligncenter" style="width: 537px"><img title="Rotores Máquina Enigma" src="http://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Enigma-action.svg/527px-Enigma-action.svg.png" alt="Rotores de la máquina Enigma" width="527" height="599" /><p class="wp-caption-text">Rotores de la máquina Enigma</p></div>
<p>After it, the signal went through the three rotors, reflected in the <em>reflector</em> and went back through the <em>rotors</em> (see figure). Finally, from the rotors it went again through the stekker, which performed a new substitution, and turned on the backlight of the corresponding letter. The net effect of the rotors and the reflector was again a permutation: each letter was converted into a different one.</p>
<p>However, if this were it, we would have no more than a simple substitution, with the only complexity of the use of an electromechanical machine. What Enigma added was a variation of the disposition of these rotors.</p>
<p>Each time a key was pressed, the rightmost rotor stepped one position. The middle rotor stepped in an odometer-like fashion, each time the rightmost rotor went through all of its steps. The leftmost rotor stepped in the same way, but depending on the middle rotor.</p>
<p>Further, it was possible to select the point where each rotor would step. This means that it could be when the previous rotor reached the initial position, but it could be in a different position. We could set it, for instance, to step when the previous rotor had stepped 5 times. From there on, it would step every time the initial rotor was in that position.</p>
<p>Therefore, Enigma was a cipher where each letter was encrypted with a different simple permutation of the alphabet... but with an enormous number of possible permutations.</p>
<p>For a more detailed analysis of the Enigma machine, please refer to the aforementioned book, where the way the machin works is analysed, the key space size (i.e. number of possible keys) is computed and an attack is presented.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-wwii-enigma" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-wwii-enigma/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Vigenère&#8217;s Cipher (2)</title>
		<link>http://www.limited-entropy.com/crypto-series-vigeneres-cipher-2</link>
		<comments>http://www.limited-entropy.com/crypto-series-vigeneres-cipher-2#comments</comments>
		<pubDate>Sat, 11 Apr 2009 08:40:24 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=187</guid>
		<description><![CDATA[As I promished, we're gonna see a different method to obtain the key length used to encrypt a text using Vigenère's algorithm. This is a method somewhat more difficult to understand than Kasiski's method, since it requires some mathematical analysis to obtain the recipe. Friedman's test or the incidence of coincidences This method, discovered by [...]]]></description>
			<content:encoded><![CDATA[<p>As I promished, we're gonna see a different method to obtain the key length used to encrypt a text using <a href="http://www.limited-entropy.com/crypto-series-vigenere">Vigenère's algorithm</a>. This is a method somewhat more difficult to understand than Kasiski's method, since it requires some mathematical analysis to obtain the <em>recipe</em>.</p>
<p><strong>Friedman's test or the incidence of coincidences</strong></p>
<p>This method, discovered by <a href="http://en.wikipedia.org/wiki/William_F._Friedman">William F. Friedman</a> in the 1920s, is based on computing the index of coincidences of the cryptogram's letters. The idea is that for two random letters from the cryptogram to be the same, there is a possibility that they were also the same in the original plaintext if the number of letters they have in between is a multiple of the key length.</p>
<p>Basically, we'll take the X first letters of the cryptogram and the X last letters, and count the number of coinciding letters in the same position. Finally, we'll divide this number by the number of letters taken and then we will have the index of coincidence.</p>
<p>Considering a source providing independent characters with the frequency distribution of English, and uniformly distributed characters for the key (i.e. all letters with the same frequency, 1/26 for the English alphabet), we have that:</p>
<ul>
<li>The probability that any two letters are the same is approximately 0.0385 when X is not a multiple of the key length</li>
<li>The probability that any two letters are the same is approximately 0.0688 when X is a multiple of the key length.</li>
</ul>
<p>So, with this process wi can determine that <em>high</em> values for the index of coincidence will mean that the shifted distance X is a multiple of the key length, and this way we will determine the most likely key length.</p>
<p>Let's see how we get these probabilities, so that we are able to obtain them in case of having a language different than English. We simply have to consider that for any two ciphertext characters <img src='http://s.wordpress.com/latex.php?latex=c_i&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_i' title='c_i' class='latex' /> and <img src='http://s.wordpress.com/latex.php?latex=c_j&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_j' title='c_j' class='latex' /> to coincide, the following relation must hold:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=c_i%20%3D%20%28%20m_i%20%2B%20k_%7Bi%20mod%20L%7D%20%29%20%3D%20%28%20m_j%20%2B%20k_%7Bj%20mod%20L%7D%20%29%20%3D%20c_j%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='c_i = ( m_i + k_{i mod L} ) = ( m_j + k_{j mod L} ) = c_j ' title='c_i = ( m_i + k_{i mod L} ) = ( m_j + k_{j mod L} ) = c_j ' class='latex' /></p>
<p style="text-align: left;">Then, we consider two different cases: if L divides i-j, then <img src='http://s.wordpress.com/latex.php?latex=m_i%20%3D%20m_j%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='m_i = m_j ' title='m_i = m_j ' class='latex' /> , since in that case we have that<img src='http://s.wordpress.com/latex.php?latex=k_%7Bi%20mod%20L%7D%20%3D%20k_%7Bj%20mod%20L%7D%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='k_{i mod L} = k_{j mod L} ' title='k_{i mod L} = k_{j mod L} ' class='latex' />  . So, the probability for this case is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=Pr%5Bc_i%3Dc_j%5D%20%3D%20%3DPr%5Bm_i%3Dm_j%5D%3D%20sum_m%20Pr%5Bm_i%3Dm_j%3Dm%5D%3Dsum_m%20p%28m%29%5E2%20approx%200.0688&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr[c_i=c_j] = =Pr[m_i=m_j]= sum_m Pr[m_i=m_j=m]=sum_m p(m)^2 approx 0.0688' title='Pr[c_i=c_j] = =Pr[m_i=m_j]= sum_m Pr[m_i=m_j=m]=sum_m p(m)^2 approx 0.0688' class='latex' /></p>
<p style="text-align: left;">However, when i-j is not a multiple of L, then for the two ciphertext characters to be equal the following equation needs to hold</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=Pr%5Bc_i%3Dc_j%5D%20%3D%20Pr%5B%20k_%7Bj%20mod%20L%7D%20%3D%20m_i%20%2B%20k_%7Bi%20mod%20L%7D%20-%20m_j%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr[c_i=c_j] = Pr[ k_{j mod L} = m_i + k_{i mod L} - m_j ' title='Pr[c_i=c_j] = Pr[ k_{j mod L} = m_i + k_{i mod L} - m_j ' class='latex' /></p>
<p style="text-align: left;">But as we said before, the distribution of key characters <img src='http://s.wordpress.com/latex.php?latex=k_j%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='k_j ' title='k_j ' class='latex' /> is uniform, and therefore this probability is:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=Pr%5Bc_i%3Dc_j%5D%20%3D%20frac%7B1%7D%7B26%7D%20approx%200.0385%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr[c_i=c_j] = frac{1}{26} approx 0.0385 ' title='Pr[c_i=c_j] = frac{1}{26} approx 0.0385 ' class='latex' /></p>
<p style="text-align: left;">That's it for today. This time there is no example, but stay tuned cause we'll see an exercise soon <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: left;">And I hope next week I'm able to post some practical exercise using Cryptool to analyze a Vigenère cipher or something alike.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-vigeneres-cipher-2" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-vigeneres-cipher-2/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Classical ciphers</title>
		<link>http://www.limited-entropy.com/crypto-series-classical-ciphers</link>
		<comments>http://www.limited-entropy.com/crypto-series-classical-ciphers#comments</comments>
		<pubDate>Mon, 09 Mar 2009 18:49:22 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=144</guid>
		<description><![CDATA[During some posts we're gonna get introduced into classical ciphers. From Wikipedia, "a classical cipher is a type of cipher used historically but which now have fallen, for the most part, into disuse". This post will study one of the most known classical ciphers, the Caesar cipher, and other similar ciphers. Caesar Cipher Caesar's cipher, [...]]]></description>
			<content:encoded><![CDATA[<p>During some posts we're gonna get introduced into classical ciphers. From <a href="http://en.wikipedia.org/wiki/Classical_cipher">Wikipedia</a>, <em>"a <strong>classical cipher</strong> is a type of <a title="Cipher" href="http://en.wikipedia.org/wiki/Cipher">cipher</a></em> used historically but which now have fallen, for the most part, into disuse".</p>
<p>This post will study one of the most known classical ciphers, the Caesar cipher, and other similar ciphers.</p>
<h3>Caesar Cipher</h3>
<p>Caesar's cipher, named after Julius Caesar, is a substitution cipher that simply substitutes each letter by the letter K positions to the right in the alphabet. So, for a K value of 3, A would be encrypted as D, B as E, C as F and so on.</p>
<p>In mathematical terms, considering an alphabet with 26 letters, where A would be letter 0 and Z letter 25, we can define these encryption and decryption operations as:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=E_k%28m%29%20%3D%20%28m%20%2B%20k%29%20mod%7B26%7D%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='E_k(m) = (m + k) mod{26} ' title='E_k(m) = (m + k) mod{26} ' class='latex' /></p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=D_k%28c%29%20%3D%20%28m%20-%20k%29%20mod%7B26%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='D_k(c) = (m - k) mod{26}' title='D_k(c) = (m - k) mod{26}' class='latex' /></p>
<p>Where <img src='http://s.wordpress.com/latex.php?latex=mod%7B26%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='mod{26}' title='mod{26}' class='latex' /> means reducing the result modulo 26, or in simpler terms, if the result is above or below the 0-25 range, we would add/subtract 26 as many times as needed to make it fall into this range.</p>
<p>As you can see, very simple. For instance, if we encrypt the sentence <em>CRIPTOGRAFIA PARA TODOS </em>under key <em>5</em>, we get the following ciphertext: <em>HWNUYTLWFKNF UFWF YTITX</em>.</p>
<p>Here we can already see one of the weaknesses of this cipher: the structure of the plaintext remains. As you can see, last word in the message starts with a Y, then it has two T's, one I and one X. Therefore, we know that this word has the second and fourth letter identical. Also second and fourth letters are identical in the second word, but different to the ones in the last word.</p>
<p>This, in a large text and within a context, could lead us to decipher great part of the text. For instance, knowing that it's a text about information security, we can try to find words with the same structure as security or information and map these letters for all the text. With this, we would have parts of other words, and with some luck we would be able to obtain more letters by guessing those words. Continuing like this, at the end we would have the complete text.</p>
<p>Another tool that allows us to easily analyse this kind of ciphers is frequency analysis, which we mentioned previously. If we take a text encrypted using this system and count the number of appearances of each letter, and then obtain (or generate) a table of relative frequencies for the target language, we can match the most frequent letter in the ciphertext and the most frequent letter in the target language.</p>
<p>Then, since the same shift is applied to all the letters, we would have the key and would be able to obtain the complete message. In case of getting a non-sense message, we could try with the second most frequent letter instead of the first one. Since it's a statistical analysis, it's possible that the character distribution in our text doesn't completely match the original distribution, but will certainly be similar.</p>
<h3>Simple substitution ciphers</h3>
<p>Caesar's cipher we just analysed is one of the so-called <em>simple substitution ciphers</em>, which always substitute each symbol of the input alphabet by a given symbol of the output alphabet.Besides Caesar's cipher, Atbash cipher is another quite famous substitution cipher, where each the alphabet is <em>inverted</em>: A-&gt;Z, B-&gt;Y, ... Y-&gt;B, Z-&gt;A.</p>
<p>But not only these two simple substitution ciphers exist. We can create any modification of the input alphabet as output alphabet. Even then, all these ciphers suffer from the same problem: the structure is maintained and they are quite easy to break using frequency analysis and word matching.</p>
<h3>Example: Breaking a simple substitution cipher</h3>
<p>This time I encrypted an English text. This is how the ciphertext looks like:</p>
<blockquote><p>ZL VAGRERFGF NOBHG FRPHEVGL ERYNGRQ GBCVPF UNIR QEVSGRQ N YVGGYR OVG, ZBIVAT SEBZ CHER FBSGJNER NAQ ARGJBEXVAT FRPHEVGL GB PELCGBTENCUL NAQ CENPGVPNY NGGNPXF BA PELCGBTENCUVP VZCYRZRAGNGVBAF, YVXR FVQR PUNAARY NANYLFVF NGGNPXF.</p>
<p>VA GUVF EROBEA OYBT V JVYY GEL GB VAGEBQHPR GUR ERNQREF VAGB GURFR GBCVPF JVGUBHG TRGGVAT VAGB GBB PBZCYRK ZNGUF. GUR NVZ VF GB CEBIVQR NA HAQREFGNAQVAT BS PELCGBTENCUL JVGUBHG UNIVAT ERNQREF YBFG BA ZNGURZNGVPNY PBAPRCGF. LBH JVYY GRYY JURGURE V NPUVRIR GUVF TBNY BE ABG.</p></blockquote>
<p>Looks pretty complicated, doesn't it? Let's see how to approach this example, assuming this is a simple substitution cipher. First of all, we're gonna count how many times appears each letter, and then divide it by the total number of letters. I've done it with <a href="http://www.limited-entropy.com/wp-content/uploads/2009/03/freq.c">this</a> simple program I quickly coded, although it's possible to do it with Cryptool but I don't have it available right now.</p>
<p>Once it's done, we sort it by frequency. For instance, copy-pasting the output of the program into a spreadsheet in Google Docs and pressing order by the corresponding column. The top 3 letters are:</p>
<p>G     52    0.124402</p>
<p>R     38    0.090909</p>
<p>V     37    0.088517</p>
<p>So, we go to a frequency table for English (<a href="http://upload.wikimedia.org/wikipedia/en/c/c2/English-slf2.PNG">here</a>) and see that E is the most frequent letter in this language. Now we subtract 'G'-'E'=7. If we apply this key using a Caesar's cipher, we just get garbage. However, if we take 'R' as 'E, then 'R'-'E'=13. Deciphering using Caesar's cipher, we get:</p>
<blockquote><p>MY INTERESTS ABOUT SECURITY RELATED TOPICS HAVE DRIFTED A LITTLE BIT, MOVING FROM PURE SOFTWARE AND NETWORKING SECURITY TO CRYPTOGRAPHY AND PRACTICAL ATTACKS ON CRYPTOGRAPHIC IMPLEMENTATIONS, LIKE SIDE CHANNEL ANALYSIS ATTACKS.</p>
<p>IN THIS REBORN BLOG I WILL TRY TO INTRODUCE THE READERS INTO THESE TOPICS WITHOUT GETTING INTO TOO COMPLEX MATHS. THE AIM IS TO PROVIDE AN UNDERSTANDING OF CRYPTOGRAPHY WITHOUT HAVING READERS LOST ON MATHEMATICAL CONCEPTS. YOU WILL TELL WHETHER I ACHIEVE THIS GOAL OR NOT.</p></blockquote>
<p>Much more readable <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Don't you recognize it? Look at <a href="http://www.limited-entropy.com/en/about">http://www.limited-entropy.com/en/about</a> <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>We've decrypted the text, although not at our first try, but at our second. Another option would have been using 'G' as 'T', since T is the second most frequent letter in English. The result is exactly the same.</p>
<p>However, facing an unknown transformation, we would have been to play with other hints besides frequency analysis. For instance, we could use the fact that we expected to see CRYPTOGRAPHY in the text, and assign this word to the only word in the ciphertext that has the same letter in the third and the last position. Then, we would substitute all its letters in the ciphertext and would see if it makes any sense.</p>
<p>From there, we just need to continue on guessing letters... kind of a puzzle <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>That's it for today, I hope you're liking it <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Questions and comments are more than welcome!</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-classical-ciphers" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-classical-ciphers/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Classification of Attacks</title>
		<link>http://www.limited-entropy.com/crypto-series-classification-of-attacks</link>
		<comments>http://www.limited-entropy.com/crypto-series-classification-of-attacks#comments</comments>
		<pubDate>Tue, 03 Mar 2009 07:00:05 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=151</guid>
		<description><![CDATA[As a quick note on the cryptographic systems description on the previous post, I'd like to mention that atacks to cryptosystems are usually classified based on the information known to the cryptanalyst. The basic types of attacks are:ásicos son: Ciphertext-only: The cryptanalyst knows only the ciphertext, and often also some information about the context of [...]]]></description>
			<content:encoded><![CDATA[<p>As a quick note on the cryptographic systems description on the <a href="http://www.limited-entropy.com/crypto-series-basic-concepts">previous post</a>, I'd like to mention that atacks to cryptosystems are usually classified based on the information known to the cryptanalyst. The basic types of attacks are:ásicos son:</p>
<ul>
<li><strong>Ciphertext-only:</strong> The cryptanalyst knows only the ciphertext, and often also some information about the context of the message.</li>
<li><strong>Known-Plaintext: </strong>The cryptanalyst knows pairs of plaintexts and corresponding ciphertexts.</li>
<li><strong>Chosen-Plaintext:</strong> The cryptanalyst is able to choose plain texts and obtain their corresponding ciphertexts.</li>
<li><strong>Chosen-Ciphertext:</strong> The cryptanalyst can choose any ciphertext and obtain its corresponding plaintext.</li>
</ul>
<p>Although the final two kinds could seem to be identical, there is a big difference mainly when applied to public key algorithms. In these algorithms, it is usually very easy to encrypt any plaintext. Thus, these algorithms need to withstand <em>chosen-plaintext</em> attacks. However, a <em>chosen-ciphertext</em> attack would require a decryption oracle, which would return any ciphertext decrypted without exposing the decryption key.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-classification-of-attacks" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-classification-of-attacks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crypto Series: Introduction &#8211; Basic Concepts</title>
		<link>http://www.limited-entropy.com/crypto-series-basic-concepts</link>
		<comments>http://www.limited-entropy.com/crypto-series-basic-concepts#comments</comments>
		<pubDate>Mon, 02 Mar 2009 07:00:11 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Crypto Series]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=124</guid>
		<description><![CDATA[Before getting into matter, we're gonna see the basic concepts on which great part of the text is going to relay on. Don't be scared, they are very basic . These are the definitions: Cryptography is the science studying information protection, both unauthorized accesses/uses and modification of the information. Cryptography is only about using algorithms [...]]]></description>
			<content:encoded><![CDATA[<p>Before getting into matter, we're gonna see the basic concepts on which great part of the text is going to relay on. Don't be scared, they are very basic <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . These are the definitions:</p>
<p><strong>Cryptography </strong>is the science studying information protection, both unauthorized accesses/uses and modification of the information. Cryptography is only about using algorithms to protect this information, while <strong>Cryptanalysis</strong> is about studying techniques to break this protection, those algorithms designed by cryptographers. It's clear that both sides are intimately related, and both of them are grouped in what is known as <strong>Cryptology</strong>.</p>
<p>A <strong>Cryptosystem</strong> is made of the following components:</p>
<ul>
<li><em>Messages</em>: The group of all the messages that one can encrypt. Also known as <em>plaintext</em>.</li>
<li><em>Ciphertexts</em>: The group of all encrypted messages.</li>
<li><em>Keys</em>: The group of all the secrets that can be used to obtain a <em>ciphertext</em> from a <em>plaintext</em>.</li>
<li><em>Encryption and Decryption algorithms</em>: The algorithms or transformations that need to be applied to a <em>plaintext</em> in order to convert it into a <em>ciphertext</em> or back, using a <em>secret key</em>.</li>
</ul>
<p>Un <strong>Criptosistema</strong> o <strong>Sistema Criptográfico</strong> consta de los siguientes componentes:</p>
<ul>
<li><em>Mensajes</em>: Es el conjunto de todos los mensajes que se pueden cifrar. El llamado texto en claro o <em>plaintext</em>.</li>
<li><em>Criptogramas</em>: El conjunto de todos los mensajes cifrados. En inglés llamado <em>ciphertext</em>.</li>
<li><em>Claves</em>: El conjunto de secretos que se pueden utilizar para obtener un <em>criptograma</em> en base a un <em>mensaje</em>.</li>
<li><em>Algoritmos de cifrado y descifrado</em>: Los algoritmos o transformaciones necesarias para convertir un <em>mensaje</em> en su correspondiente <em>criptograma</em> y viceversa, haciendo uso de una <em>clave secreta</em>.</li>
</ul>
<p>So, given a cryptosystem with its encryption algorithm, which we denote as <img src='http://s.wordpress.com/latex.php?latex=C%3DE_k%28M%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='C=E_k(M)' title='C=E_k(M)' class='latex' />, and its corresponding decryption algorithm ( <img src='http://s.wordpress.com/latex.php?latex=M%3DD_%7Bk%5Eprime%7D%28C%29%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='M=D_{k^prime}(C) ' title='M=D_{k^prime}(C) ' class='latex' /> ), the following equation must hold:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=D_%7Bk%5Eprime%7D%28E_k%28M%29%29%3DM%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='D_{k^prime}(E_k(M))=M ' title='D_{k^prime}(E_k(M))=M ' class='latex' /></p>
<p style="text-align: left;">Where k y k' are the corresponding <em>encryption and decryption keys</em>. These keys might be identical (symmetric crypto) or different (asymmetric crypto), as we'll see later.</p>
<p style="text-align: left;">This means that when you decrypt a message encrypted under key <em>K</em> using its corresponding decryption key <em>K'</em>, you obtain the original message. Obvious, isn't it?</p>
<p style="text-align: left;">The figure below shows the conventional cryptosystem as depicted by C.E. Shannon in its book Communication Theory and Secrecy Systems.</p>
<div id="attachment_138" class="wp-caption aligncenter" style="width: 574px"><img class="size-full wp-image-138" title="Cryptosystem scheme" src="http://www.limited-entropy.com/wp-content/uploads/2009/03/shannon_scaled.png" alt="Esquema de un criptosistema" width="564" height="212" /><p class="wp-caption-text">Cryptosystem scheme</p></div>
<p style="text-align: center;">
<p>Finally, to finish this post about basic concepts, we'll see how to statistically characterize a message source. Statistical characterization of a language is a quite powerful tool on its own when it's about analyzing a cipher, specially in case of basic ciphers as we'll see in the next post.</p>
<p>Let's imagine a message source that produces messages in a given language, for instance Spanish. We can try to characterize the source by  means of the probability that a certain character appears in the text, independent of the rest of the text.</p>
<p>Thus, a character <em>c</em> would appear with a probability <img src='http://s.wordpress.com/latex.php?latex=Pr%28c%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr(c)' title='Pr(c)' class='latex' />. With this characterization, the word <em>hola</em> would appear with a probability of:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=Pr%28hola%29%3DPr%28h%29cdot%20Pr%28o%29cdot%20Pr%28l%29%20cdot%20Pr%28a%29%20&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr(hola)=Pr(h)cdot Pr(o)cdot Pr(l) cdot Pr(a) ' title='Pr(hola)=Pr(h)cdot Pr(o)cdot Pr(l) cdot Pr(a) ' class='latex' /></p>
<p style="text-align: left;">A slightly more powerful option would be characterizing the language as a series of bi-grams (i.e. groups of two characters) with a given probability. In this case, the word <em>hello</em> would have the following probability:</p>
<p style="text-align: center;"><img src='http://s.wordpress.com/latex.php?latex=Pr%28hola%29%3DPr%28ho%29cdot%20Pr%28la%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='Pr(hola)=Pr(ho)cdot Pr(la)' title='Pr(hola)=Pr(ho)cdot Pr(la)' class='latex' /></p>
<p style="text-align: left;">However, this option besides being an identical concept to the former one, requires of much bigger frequency tables and more effort to characterize the message source.</p>
<p style="text-align: left;">A question that might arise now is how would we manage to  obtain a table of relative frequencies for each one of the letters. Basically, we would take a sufficiently large text in the given language and count the number of times each letter appears. Then we divide this number by the total of letters in the text, and get its relative frequency. Frequency tables can be seen in <a href="http://en.wikipedia.org/wiki/Frequency_analysis_(cryptanalysis)">Frequency Analysis</a> [Wikipedia].</p>
<p style="text-align: left;">Next time we'll see how this frequency characterization with independent charactes can be useful to break basic ciphers.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/crypto-series-basic-concepts" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/crypto-series-basic-concepts/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Book Review: The IDA Pro Book</title>
		<link>http://www.limited-entropy.com/book-review-the-ida-pro-book</link>
		<comments>http://www.limited-entropy.com/book-review-the-ida-pro-book#comments</comments>
		<pubDate>Mon, 24 Nov 2008 21:51:42 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Docs]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[IDA]]></category>
		<category><![CDATA[reversing]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=103</guid>
		<description><![CDATA[[DISCLAIMER: Este post va en inglés puesto que el libro también es en inglés... y a quien le interese lo entenderá] At the beginning of last month I ordered a copy of The IDA Pro book from Chris Eagle at Amazon. Since reversing has been one of my pending subjects for a while now, and [...]]]></description>
			<content:encoded><![CDATA[<p>[DISCLAIMER: Este post va en inglés puesto que el libro también es en inglés... y a quien le interese lo entenderá]</p>
<p>At the beginning of last month I ordered a copy of <a href="http://www.idabook.com/">The IDA Pro book</a> from Chris Eagle at Amazon. Since reversing has been one of my pending subjects for a while now, and after seeing it recommended by Ilfak's himself, I decided to buy the book. I've just finished my first reading of the whole book, and before going into applying the acquired knowledge I've thought it may be useful to share my opinion with you.</p>
<p>The book is divided into 5 different parts. Part I, <em>Introduction to IDA</em>, covers the very basis about disassembling, reversing and reversing tools, and IDA Pro.</p>
<p>Part II, <em>Basic IDA usage</em>, introduces the reader into the IDA world in chapters 4 to 10. After introducing the user interface and the different IDA displays, Chir Eagle goes into disassembly navigation and manipulation, data types, cross-references and graphing, and finally the different IDA flavours apart from the <em>normal</em> Win32 GUI version (console mode for Windows,Linux,OS X). Chapter 8 about datatypes and data structures also provides a nice covering of C++ reversing, showing how to locate <em>vtables</em> and explaining inheritance relationships among others.</p>
<p>Part III, <em>Advanced IDA usage</em>, extends the IDA knowledge provided in the previous part by discussing its configuration files, library recognition methods, how to extend IDA's knowledge about library functions and, although it is not its main purpose, what can IDA do for us if we want to patch a binary.</p>
<p>Part IV of the book discusses the available options to extend IDA's functionality: IDC scripts, the IDA SDK, plug-in development and processor and loader modules. To be honest, I skipped a big chunk of this part because I believe it is not worth now. I'll just come back to these chapters once I start disassembling things and needing to tailor IDA's functionality to my needs.</p>
<p>Part V discusses how to deal with real-world problems. It starts with a chapter about the different assembly code produced by different compilers for the same source code, and then goes into a very interesting description about obfuscated code analysis (from the static analysis perspective mainly). Next, Eagle gives some hints on how to use IDA for finding vulnerabilities and provides a list of several useful real-world IDA plugins.</p>
<p>Last part of the book, Part VI, discusses the IDA debugger and its integration with the disassembler. This part starts with an introduction chapter, continues with a discussion on its integration with the disassembler and ends with a chapter about remote debugging with IDA.</p>
<p>As you have seen, this book provides a thorough coverage of IDA's capabilities, and gives real world examples. The examples, together with the IDC and plug-in code, make it a very interesting reading for those willing to learn about reversing and about the most popular disassembler these days.</p>
<p>If you'd like to learn how to use IDA efficiently, how to tailor it to your needs and automate your static analysis tasks, this is your book. Definitely, it is worth the money if you want to get into IDA and have a good reference book.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/book-review-the-ida-pro-book" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/book-review-the-ida-pro-book/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>El malingo presenta Reto Hacking IX</title>
		<link>http://www.limited-entropy.com/el-malingo-presenta-reto-hacking-ix</link>
		<comments>http://www.limited-entropy.com/el-malingo-presenta-reto-hacking-ix#comments</comments>
		<pubDate>Fri, 12 Sep 2008 12:33:48 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[juegos]]></category>
		<category><![CDATA[reto hacking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[wargame]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=97</guid>
		<description><![CDATA[El maligno ha anunciado que esta noche, a las 20:00, empieza el Reto Hacking IX. El reto cuenta con 10 niveles, y los premios además de puntuar en la general de los retos hacking de este año, son estos (copia-pega de la entrada del maligno): - Primero: La gloria, la fama, el honor de hacer [...]]]></description>
			<content:encoded><![CDATA[<p>El <a href="http://elladodelmal.blogspot.com">maligno</a> <a href="http://elladodelmal.blogspot.com/2008/09/hay-que-ser-muy-hombre-o-muy-mujer.html">ha anunciado </a>que esta noche, a las 20:00, empieza el <a href="http://retohacking9.elladodelmal.com/">Reto Hacking IX</a>. El reto cuenta con 10 niveles, y los premios además de puntuar en la general de los retos hacking de este año, son estos (copia-pega de la entrada del maligno):</p>
<blockquote><p>- <strong><em>Primero</em></strong>: La gloria, la fama, el honor de hacer un solucionario y responder a una entrevista para el lado del mal. Además, una cena y unos cubatas en tu ciudad (como gane quién yo me sé va a ir a Zurich la madre del topo) que quedará para la historia con fotos que no querras-que-vean-tus-descencientes.</p>
<p><strong><em>UPDATE: El primero se llevará el Badge de la Defcon16</em></strong></p>
<p>- <strong><em>Segundo</em></strong>: El honor de ser el primer Luser, el gran perdedor, el perdedor oficial. El título honorífico de ser el Luser del Reto Hacking IX y sí, una cena, pero las copas las pagas tú que para eso deberías haber ganado.</p>
<p><strong><em>UPDATE: El segundo se llevará tres pegatas de la Defcon16</em></strong></p>
<p>- <strong><em>Tercero</em></strong>: A ti te voy a regalar un libro de hacking para que sigas practicando y así alcances la gloria de ser el campeón o de ser el No Luser.</p>
<p><strong><em>UPDATE: El tercero se llevará una pegata de la Defcon16</em></strong></p></blockquote>
<p>Yo si tengo tiempo me pondré a ratos, aunque en un plazo de una semana presento el PFC y luego vienen fiestas del pueblo, así que no estaré muy libre para ponerme...</p>
<p>Suerte a los que os decidáis!</p>
<p><strong>EDITADO: </strong>Ayer estuve pegandole un ratillo cuando llegué a las 9, un poquitín más después de cenar y otro rato cuando volví de dar una vuelta por ahí. La cosa va de romper CAPTCHA's, pasé los niveles 1-5 pero el 6 se me resiste... no veo NADA de momento <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' />  .</p>
<p>Las soluciones las estoy haciendo con PHP con libcURL, reutilizando un script que usé en la CampusParty de 2006 (creo). Te suena Javi? xD Esta vez toca hacer cosas 'parecidas' pero hay que saltarse el captcha 1000 veces en 60 minutos, con lo que automatizarlo es clave (y un coñazo la espera xD).</p>
<p><strong>EDITADO 2: </strong>Pues ya hay ganador. Kachakil acaba de alzarse con la victoria y con los 10 puntos... el tío está en el top en todos los retos. Enhorabuena desde aquí!</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/el-malingo-presenta-reto-hacking-ix" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/el-malingo-presenta-reto-hacking-ix/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Jane: pruebas seguridad Campus Party 2008</title>
		<link>http://www.limited-entropy.com/jane-pruebas-seguridad-campus-party-2008</link>
		<comments>http://www.limited-entropy.com/jane-pruebas-seguridad-campus-party-2008#comments</comments>
		<pubDate>Wed, 06 Aug 2008 19:52:08 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Campus Party]]></category>
		<category><![CDATA[Seguridad]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=95</guid>
		<description><![CDATA[En este post voy a recopilar las soluciones de las pruebas del concurso de la Campus Party, las correspondientes a la categoría de seguridad. Pongo todo de mi memoria y de los logs del chat de equipo, así que no tengo los enunciados ni binarios ni nada... espero que quede más o menos claro todo [...]]]></description>
			<content:encoded><![CDATA[<p>En este post voy a recopilar las soluciones de las pruebas del concurso de la Campus Party, las correspondientes a la categoría de seguridad. Pongo todo de mi memoria y de los logs del chat de equipo, así que no tengo los enunciados ni binarios ni nada... espero que quede más o menos claro todo <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  El orden tampoco es 100% seguro que sea ese, pero es más o menos como nosotros lo hicimos.</p>
<p><span id="more-95"></span></p>
<p><strong>Prueba 1: token01</strong></p>
<p>En esta prueba había que obtener un <em>token</em> para acceder a la próxima prueba, mediante una aplicación que te ofrecía un desafío y había que responder con la respuesta correcta. O bien hacer un poco de ingeniería inversa, claro. En este caso era fácil, solo con strings podías sacar el token, pues salía esto:</p>
<p><em><span style="display: block; padding-left: 6em;"><span>cuchara@vm02 /home/pruebas/cuchara $ strings token01<br />
/lib/ld-linux.so.2<br />
libcrypt.so.1<br />
__gmon_start__<br />
_Jv_RegisterClasses<br />
crypt<br />
libc.so.6<br />
_IO_stdin_used<br />
exit<br />
strncmp<br />
puts<br />
printf<br />
strlen<br />
__errno_location<br />
read<br />
open<br />
scanf<br />
__libc_start_main<br />
GLIBC_2.0<br />
PTRh0<br />
0[^]<br />
[^_]<br />
Enhorabuena, has pasado la autenticacion. El token es: dyP6IQCjo05S51x</span></span></em></p>
<p><strong>Prueba 2: Aplicación web</strong></p>
<p>En este caso, nos daban la URL de un servicio de webmail, y nos pedían obtener un archivo en el directorio padre. Mirando el código fuente HTML se veía un comentario indicando que se trataba de Endymion MailMan, y buscando en bugtraq encontramos <a href="http://www.securityfocus.com/bid/4222">esto</a>.</p>
<p>Como pone, usando la variable ALTERNATE_TEMPLATE podemos conseguir un <em>file disclosure</em>, y allá que fuimos. Agregando esto a la URL: ?ALTERNATE_TEMPLATES=../u1Bjnk0R18maywv%0 0 conseguimos leer el archivo u1Bjnk0R18maywv situado en el directorio padre al servicio de webmail.</p>
<p><strong>Prueba 3: token02</strong></p>
<p>Otra de tokens, con un binario de por medio. En este caso, strings no daba ningún resultado así que no me calenté mucho la cabeza. Como gdb estaba disponible, cogí y puse un <em>breakpoint </em>justo tras la comprobación de la respuesta. Al ver que eax estaba a cero y se usaba para comprobar si el desafío era correcto (era el resultado de una comprobación) lo puse a 1 y arreglado:</p>
<p><em><span style="display: block; padding-left: 6em;"><span>(gdb) set $eax=1<br />
(gdb) next<br />
Single stepping until exit from function main,<br />
which has no line number information.<br />
Enhorabuena, has pasado la autenticacion. El token es: a15EJwU8wjkX</span></span></em></p>
<p>Sencillito <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Aunque quizás lo suyo habría sido copiar el binario y parchearlo... pero no había ganas, gdb es más eficiente para estos casos jeje</p>
<p><strong>Prueba 4: Escalada de privilegios</strong></p>
<p>Esta prueba no era difícil pero se nos (me) atragantó. Y me cabreé bastante conmigo mismo por no verlo, todo hay que decirlo <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' /> . Nos daban un ejecutable con bit setgid activo, para leer un archivo mediante el uso de una contraseña.</p>
<p>Tras probar los típicos parámetros larguísimos de N-mil A's y ver que no petaba, pasé al desensamblado y a leer el código.  El programa usaba strncpy para copiar el password a una variable local (llamémosla buf), llamaba a check_pass(buf). Seguidamente sumaba el valor devuelto por check_pass a una variable local que había inicializado a 0 al principio del programa, y si el valor era 0xeb llamaba a read_file(argv[2]).</p>
<p>El problema aquí fue que estuve eones intentando entender check_pass, tratando de hacer gdb saltar a la función read_file como hice en token02, pero claro, daba error de archivos pues al estar usando gdb no se ejecutaba con los privilegios del setgid.</p>
<p>Al final, tras las 3 horas lo dejamos y lo recogí al día siguiente por la mañana. En 5 minutos me di cuenta de que el strncpy() copiaba 100 bytes y sobreescribía la variable local (solo un byte) que se sumaba al resultado de check_pass, que era 1 cuando el password era incorrecto.</p>
<p>Así pues, la cosa quedaba algo así:</p>
<p><em><span style="display: block; padding-left: 6em;"><span>plato@vm02 /home/pruebas/plato $ ./leer_archivos `pe rl -e 'print "\xea"x1000'` secreto<br />
Enhorabuena, has conseguido leer el archivo secreto.</span></span></em></p>
<p><em>El codigo de validacion para pasar la prueba es: cfn3HqqbJlSeHsP</em></p>
<p><em>Que lo disfrutes</em></p>
<p>Sencillo verdad? Pues no lo veía, hay que... jejeje Nada como una noche descansando y una buena ducha para olvidarse de todo lo que ya has probado y ver estas cosas.</p>
<p><strong>Prueba 5: Password Cracking</strong></p>
<p>Seguidamente nos pusimos con una prueba de password cracking. Nos daban un <em>/ etc / passwd</em> y había que crackearlo en 4 horas.</p>
<p>Esta fue la prueba que menos me gustó. Había que aplicar un ataque por diccionario, pero si no tenías el diccionario en concreto lo tenías mal porque el password no tenía ningún sentido... usamos más de 4 horas y perdimos el bonus, pero bueno... que se le va a hacer, no nos iban a gustar todas las pruebas.</p>
<p>El hecho de que no me gustara es más bien porque influía mucho más la <em>suerte</em> de tener el diccionario concreto que las habilidades del participante.</p>
<p><strong>Prueba 6: Wifi</strong></p>
<p>Esta era fácil. No me pareció demasiado justo que valiera 1600 puntos pero bueno, así son las cosas. Se trataba de una captura de 2 paquetes de una wifi de las de telefónica/imagenio. Sí, de estas de WLAN_XX en las que la WEP solo depende de la MAC, la marca del router y alguna cosa más... y al final solo tienes unas 16^4 posibilidades (si no me falla la memoria).</p>
<p>Total, que usas wlandecrypter o algo similar tras generarte el diccionario y arreglado.</p>
<p><strong>Prueba 7: token03</strong></p>
<p>Otra de los tokens, esta vez un poquito más difícil. Había que obtener la respuesta para un desafío concreto. Lo que hicimos fue cargar el binario en gdb, y analizarlo un poco. Se veía que se leía de /dev/urandom, había un printf que probablemente mostraba el desafío, y un scanf que leía el mismo.</p>
<p>Tras ello había un crypt() y un strncmp(). Esto nos indica que probablemente la respuesta al desafío fuera crypt(desafio,salt), donde nos falta por averiguar el salt. Con gdb o con IDA Pro era fácil encontrar el salt, que era la cadena <em>cp</em>.</p>
<p>Así pues, este sencillo programa nos daría la solución:</p>
<p><em>#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt;</em></p>
<p><em>int main(int ac, char **av){<br />
char *str;</em></p>
<p><em>str=crypt(av[1],"cp");</em></p>
<p><em>printf("%s\n",str);<br />
}</em></p>
<p>Tras ejecutarlo como:</p>
<p><em>$ ./a.out HugGOJ28<br />
cpbSFUhk1FzG</em></p>
<p>No era demasiado difícil no? <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Prueba 8: Ingeniería inversa</strong></p>
<p>Esta era la última prueba (si no me dejo ninguna). Esta no la pasamos, porque era muy complicada y porque no teníamos nada de tiempo. Se nos daba un dump de memoria (a partir de la dirección 0x080000) de un integrado, del cual se nos daba la foto. Aparecía marcado GC2-D2C en el mismo, lo que nos indica que algo tiene que ver con la wii.</p>
<p>Ahora sé que es un micro Panasonic MN102 y parece estar soportado por IDA Pro, al menos la versión 5.3 debería soportarlo. Se nos pedía un password que controlaba el acceso al resto del <em>firmware </em>y la función de <em>la instrucción 0x60</em>.</p>
<p>No llegamos a analizar nada, puesto que quedaban 2 horas y dieron 8 para el bonus, así que nos dio tiempo a nada. A parte de que no sabíamos qué micro llevaba ese chip y no podíamos desensamblar nada claro...</p>
<p>En fin, esta me la dejo por si tengo un rato y ganas de frikear... si lo hago ya contaré algo por aquí <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Se acabó</strong></p>
<p>Pues eso, hasta aquí mis soluciones rápidas a las pruebas del concurso de seguridad de esta Campus Party 2008. Desde aquí agradecer a Pedro, Rapul y Jaime por el curro que se pegaron con el concurso, y por entretenernos un tiempo.</p>
<p>Y también dar las gracias a Javi y a Amin por ese equipo que formamos, que funcionó a la perfección <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Y también quiero cagarme en el mod_security de este servidor... que no me dejaba postear algunas palabras, de ahí los espacios que he metido en algunos.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/jane-pruebas-seguridad-campus-party-2008" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/jane-pruebas-seguridad-campus-party-2008/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Verificación de protocolos criptográfico: modelando objetivos</title>
		<link>http://www.limited-entropy.com/verificacion-de-protocolos-criptografico-modelando-objetivos</link>
		<comments>http://www.limited-entropy.com/verificacion-de-protocolos-criptografico-modelando-objetivos#comments</comments>
		<pubDate>Sat, 19 Jul 2008 19:26:41 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[IEEE]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Protocol Verification]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=90</guid>
		<description><![CDATA[Seguimos con la serie de verificación de protocolos, después de los anteriores: Introducción Modelado (I) Modelado (II) Ahora nos toca ver cómo completamos nuestros modelos mediante la inclusión de los objetivos del protocolo en ellos. En spi-calculus, para modelar el objetivo de confidencialidad simplemente usamos aserciones ( secrecy assertions en inglés ). Las aserciones son [...]]]></description>
			<content:encoded><![CDATA[<p>Seguimos con la serie de verificación de protocolos, después de los anteriores:</p>
<ul>
<li><a href="http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-introduccion">Introducción</a></li>
<li><a href="http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-i">Modelado (I)</a></li>
<li><a href="http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-ii">Modelado (II)</a></li>
</ul>
<p>Ahora nos toca ver cómo completamos nuestros modelos mediante la inclusión de los objetivos del protocolo en ellos. En <em>spi-calculus</em>, para modelar el objetivo de <strong>confidencialidad </strong>simplemente usamos aserciones<em> </em>( <em>secrecy assertions</em> en inglés ). Las aserciones son mecanismos que no modifican el flujo del modelo ( no influyen en la <em>semántica operacional</em> ) y simplemente indican que un agente espera que un determinado valor se mantenga secreto. Por ejemplo, podríamos escribir:</p>
<p><em>Pa = new s; ( secret(s) | out net {s}kab)<br />
Pb= inp net x; decrypt x is {s}kab; secret(s)</em></p>
<p>De esta forma, se especifica que ambos agentes creen que <em>s</em> es un secreto.</p>
<p>Por otra parte, para especificar opciones de autenticidad nos valemos de <em>aserciones de correspondencia </em>( <em>correspondence assertions</em> ). Esto simplemente significa que el agente que inicia la autenticación iniciará la aserción de correspondencia con unos parámetros, y el que la acaba la finalizará. Para que todo vaya bien, si existe una finalización debería haber existido antes una inicialización con los mismos parámetros.</p>
<p>Espero que se vea mejor con este ejemplo tomado de los apuntes de Cristian Haacks como una narración informal:</p>
<p><em>A begins! Send (A, m, B)<br />
A ? S : A, {B, m}kas<br />
S ? B : {A, m}kbs<br />
B ends Send (A, m, B)<br />
</em><br />
Así pues, decimos que es seguro si no existe la posibilidad de que se ejecute el <em>B ends Send(A,m,B)</em> sin que antes e haya ejecutado un <em>A begins! Send(A,m,B)</em>. Para acabar, el ! indica que esta aserción se repite indefinidas veces, es decir que un evento <em>begin </em>puede corresponderse con un <em>end</em> repetidas veces. Un ejemplo de esto sería una firma digital, puesto que la firma se puede comprobar muchas veces y siempre será válida. Sin embargo, a veces interesa que solo se de una vez, para garantizar la <em>frescura</em> de la información y evitar <em>replay attacks</em>.</p>
<p>Para ello, se usan eventos inyectivos, que se modelan sin el <em>!</em> y simplemente un <em>begin</em> puede corresponderse con un <em>end, </em>y nunca más. Para conseguir esto, los protocolos hacen uso de números de secuencia, <em>nonces (number used once), timestamps</em> o similares.</p>
<p>Realmente hay un poco más de <em>chica</em> por aquí detrás con cómo se propagan estos eventos por los canales y demás, pero vamos a dejarlo en que se considera seguro si esto ocurre, ya que en caso contrario significaría que el atacante puede forzar a B a ejecutar un <em>end Send(A,m,B) </em>sin que realmente A haya mandado el mensaje B, lo cual viola la autenticación.</p>
<p>También hay un poco más de teoría respecto a <em>Spi-calculus</em> y procesos <em>seguros respecto a confidencialidad</em>, que especifica qué procesos se pueden denominar así. Intuitivamente, son aquellos procesos en los que no existe ninguna manera de llegar a algo que escriba un secreto en un canal público mediante la <em>semántica operacional</em> de <em>spi-calculus</em>.</p>
<p>Ahora bien, después de este rollo, cómo nos lo montamos con <strong><em>ProVerif</em> </strong>para especificar estas propiedades? Pues es bastante sencillo:</p>
<p>Las metas de confidencialidad, simplemente se especifican en la zona de declaraciones con una <em>query</em> tal que así:</p>
<p><em>query attacker: s.</em></p>
<p>Donde s es el valor que queremos que sea secreto. El problema es que ProVerif usa macros y los nombres son globales, así que si creamos dos nombres iguales en distintos <em>procesos </em>y hacemos una query, irá para los dos. Además, si usamos variables para las <em>queries</em>, siempre dará que el atacante puede obtenerlo mientras que no es necesariamente cierto.</p>
<p>Para este caso, lo que podemos hacer es generar un flag único y pedir a ProVerif que nos diga si el flag puede obtenerse. Por ejemplo, imaginemos la variable <em>M</em> que ha sido obtenida mediante tras leer de la red. Si queremos que sea secreta, deberíamos hacer algo como:</p>
<p><em>query attacker: M.<br />
process (*otro_proceso*)|(in(net,M))</em></p>
<p>Pero entonces ProVerif nos dirá que el atacante puede obtener M, ya que es una variable. Lo que haríamos sería:</p>
<p><em>query attacker:flagM.</em><em><br />
process (*otro_proceso*)|(in(net,M);out(M,flagM);)</em></p>
<p>En este caso, si el atacante puede conocer M podrá leer del canal M, con lo que podrá obtener el flag y la <em>query</em> fallará. Si no, no podrá obtener el flag y no fallará.</p>
<p>Por otra parte, las aserciones de correspondencia se transforman en eventos, y podemos especificar que un evento debe estar precedido por otro. Un ejemplo sacado de mis códigos de ProVerif sería:</p>
<p><em>query evinj : endSendToInit(x,y,z) ==&gt; evinj : beginSendToInit(x,y,z).<br />
query evinj : endSendToResp(x,y,z) ==&gt; evinj : beginSendToResp(x,y,z).<br />
query evinj : endAckToInit(x,y,z) ==&gt; evinj : beginAckToInit(x,y,z).<br />
query evinj : endAckToResp(x,y,z) ==&gt; evinj : beginAckToResp(x,y,z).<br />
</em></p>
<p>Aquí estamos diciendo que el evento endSendToInit(x,y,z) debe estar precedido por el evento beginSendToInit(x,y,z), y lo mismo para el resto de eventos. La palabra clave <em>evinj</em> indica que se trata de una correspondencia inyectiva, es decir uno a uno. Si usaramos <em>ev </em>en su lugar se trataría de correspondencia no inyectiva, muchos a uno.</p>
<p>Por último, comentar que es posible especificar en ProVerif la propiedad de <em>no interferencia </em>(<em> non-interference</em> ), que significa que un atacante no será capaz de distinguir una ejecución del protocolo de otra cambiando los valores de las variables de las que deseamos preservar dicha propiedad.</p>
<p>Dicho más sencillo: que no se puede obtener ninguna información de las variables, ni siquiera si son iguales o distintas de una ejecución a la otra. Por ejemplo, esto no cumpliría dicha propiedad:</p>
<p><em>P(x) = out(net,{x}k);</em></p>
<p>Puesto que si {x1}k es igual a {x2}k, entonces x1 es igual a x2. Para resolverlo usaríamos cifrado no determinístico, que simplemente añade una parte aleatoria al mensaje. Algo así:</p>
<p><em>P(x) = new n; out(net,{(x,n)}k);</em></p>
<p>De esta forma, como <em>n</em> es aleatorio y presumiblemente diferente cada vez, que el texto cifrado sea igual no implica que el contenido lo sea.</p>
<p>Para especificar esta propiedad, en ProVerif escribiremos por ejemplo:</p>
<p><em>noninterf x1,x2.</em></p>
<p>Y luego modelaremos dos procesos en paralelo, uno con x1 y otro con x2. Tras ejecutar ProVerif (que ya veremos cómo se hace en otro post) nos dirá si se puede distinguir entre ellos o no.</p>
<p>Esto es todo de momento... sigo dandoos el coñazo con teoría que puede que no se entienda mucho <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' /> , pero en el próximo post explicaré cómo ejecutar ProVerif y un pequeño ejemplo con varias cosas juntas, y después en el siguiente analizaremos el modelo de TLS que puse hace un tiempo.</p>
<p>Si alguien está leyendo esto, que comente si se entiende más o menos o algo <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ( Y quien lo esté leyendo es todo un campeón xD)</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/verificacion-de-protocolos-criptografico-modelando-objetivos" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/verificacion-de-protocolos-criptografico-modelando-objetivos/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Verificación de protocolos criptográficos: Modelado (II)</title>
		<link>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-ii</link>
		<comments>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-ii#comments</comments>
		<pubDate>Sat, 12 Jul 2008 15:06:30 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=89</guid>
		<description><![CDATA[Continuamos en este post con las técnicas de modelado de protocolos criptográficos. Ahora sí vamos a adentrarnos en el mundo de ProVerif viendo la sintaxis que usa para definir los protocolos. Un archivo fuente de ProVerif puede estar en spi-calculus o mediante cláusulas de Horn. Nosotros solo vamos a ver spi-calculus entre otras cosas porque [...]]]></description>
			<content:encoded><![CDATA[<p>Continuamos en este post con las técnicas de modelado de protocolos criptográficos. Ahora sí vamos a adentrarnos en el mundo de ProVerif viendo la sintaxis que usa para definir los protocolos.</p>
<p>Un archivo fuente de ProVerif puede estar en <em>spi-calculus</em> o mediante cláusulas de Horn. Nosotros solo vamos a ver <em>spi-calculus</em> entre otras cosas porque yo de cláusulas de Horn ni idea <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' />  . Los archivos fuente <em>.pi</em> tienen varias partes que vamos a ver por separado:</p>
<p><span id="more-89"></span></p>
<p><strong>Declaración de nombres</strong></p>
<p>Generalmente al inicio del código se declaran los <em>nombres</em> que se van a usar en el modelo. Esto suele incluir los canales de comunicación públicos, identificadores de usuario, <em>tags</em> para los mensajes, etc.</p>
<p>La sintaxis es sencilla: <em>[private] free nombre.</em> declararía <em>nombre</em>, donde el atributo opcional <em>private</em> indica que solo se puede usar si está explícitamente escrito en el modelo. Es decir, el atacante no tendrá acceso a dicho nombre si anteponemos la palabra <em>private</em> en su declaración.</p>
<p><strong>Constructores y reglas de reducción</strong></p>
<p>Estos son un mecanismo genérico para modelar operaciones como cifrado/descifrado, hashes, derivación de claves a partir del identificador de agente y otros. Básicamente, definimos un constructor como una función de varias variables, y una regla de reducción para poder <em>deshacer</em> lo que hizo el constructor.</p>
<p>La sintaxis es como sigue:</p>
<p><em>fun constructor/n.<br />
reduc destruct(construct(...),...) = ... .</em></p>
<p>Con un ejemplo queda claro enseguida. Lo siguiente sería para definir cifrado/descifrado de forma simétrica:</p>
<p><em>fun encrypt/2<br />
reduc decrypt(encrypt(x,y),y) = x.</em></p>
<p>Como se puede ver, definimos un constructor con 2 parámetros, y definimos un destructor de forma que si aplicamos <em>decrypt(c,y) </em>donde <em>c</em> ha sido construido como <em>encrypt(x,y)</em>, entonces devuelve x. Es decir, <em>y</em> en este caso sería la clave, y <em>x</em> el mensaje a cifrar.</p>
<p>Para un hash, simplemente definiríamos un constructor con 1 único mensaje y sin definir un destructor. De esta forma tenemos una función no invertible perfecta y sin colisiones.</p>
<p><strong>Macros de procesos</strong></p>
<p>Se pueden definir macros de procesos para hacer el código más legible. La sintaxis es:</p>
<p><em>let proceso = &lt;codigo_del_proceso&gt;.</em></p>
<p>De esta forma, podemos definir los distintos roles del protocolo en macros separadas y luego juntarlas en el proceso principal.</p>
<p><strong>Proceso principal</strong></p>
<p>Finalmente, el proceso principal se define de la siguiente forma:</p>
<p><em>process<br />
...</em></p>
<p>Donde en ... podemos referirnos a los procesos creados mediante macros por su nombre, y ProVerif los sustituirá directamente ahí, de forma textual. No se debe pensar en ellos en forma de funciones, sino simplemente que se reemplazará cualquier aparición de su nombre por el contenido definido en la macro.</p>
<p><strong>Consultas</strong></p>
<p>Además, ProVerif permite especificar consultas, que normalmente ponemos después de las declaraciones de nombres. Esto nos permite verificar si se cumplen los objetivos del protocolo, pero lo veremos en otro post cuando veamos cómo modelar los objetivos.</p>
<p><strong>Diferencias con spi-calculus<br />
</strong></p>
<p>Existen algunas diferencias con <em>spi-calculus</em> en la sintaxis, por ejemplo en la forma de escribir/leer a/de un canal de comunicación, la forma de <em>dividir</em> tuplas y algunas cosillas más. Lo mejor es que veamos un ejemplo del protocolo que pusimos en el post anterior para aclarar todo.</p>
<p><strong>Ejemplo</strong></p>
<p>Veamos cómo modelar en ProVerif el protocolo simple del post anterior. La narración informal del protocolo era tal que así:</p>
<p><em>A-&gt;B: (M,A)<br />
B-&gt;A: N<br />
A-&gt;B: {| #(M,B,N) |}sA</em><br />
En primer lugar, generaremos los nombres de usuario, el canal de comunicación y los constructores:</p>
<p><em>free net, A,B,Sign.<br />
fun hash/1.<br />
fun pencrypt(x,enc(y)).<br />
reduc pdecrypt(pencrypt(x,enc(y)),dec(y)).</em></p>
<p>Como se puede adivinar, <em>pencrypt/pdecrypt</em> definen la criptografía de clave pública que usaremos, donde <em>enc()</em> y <em>dec()</em> identifican la parte de cifrado y la parte de descifrado de un par de claves.</p>
<p>Seguidamente, veremos el proceso A y B:</p>
<p><em>let procA = new m;out(net,(m,A));in(net,n);out(net,pencrypt((m,n,B),enc(kpa) ).<br />
let procB = in(net,(m,=A));new n;out(net,n);in(net,signed); let (=m,=n,=B) = pdecrypt(signed,dec(kpa)) in 0.</em></p>
<p>En este caso, he asumido que <em>kpa</em> es el par de claves de A y lo he usado directamente en los procesos, aunque aun no lo hemos generado. Como se puede ver, es mucho menos engorroso que <em>spi-calculus</em> directamente, puesto que permite especificar coincidencias en los mensajes leídos del canal, leer directamente varios valores sin tener que hacer primero el inp y luego el <em>split, </em>etcétera.</p>
<p>Finalmente, nos falta definir el proceso que los junte:</p>
<p><em>process<br />
new kpa; ( procA | procB )</em></p>
<p>Con esto tendríamos modelado el protocolo, aunque no habría ningún objetivo especificado y realmente ProVerif no hará nada.</p>
<p>En los próximos posts veremos cómo modelar los objetivos y cómo leer la salida de ProVerif, que es capaz incluso de dar ataques en algunas ocasiones.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-ii" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-ii/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verificación de protocolos criptográficos: Modelado (I)</title>
		<link>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-i</link>
		<comments>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-i#comments</comments>
		<pubDate>Sat, 12 Jul 2008 11:00:00 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Protocol Verification]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=87</guid>
		<description><![CDATA[En este segundo post vamos a ver lenguajes para el modelado de protocolos criptográficos. Con la ayuda de estos lenguajes, seremos capaces de crear un modelo del protocolo para analizarlo mediante ProVerif. Empezamos con una manera informal de definir protocolos, seguimos con spi-calculus, y finalmente vemos la sintaxis concreta de ProVerif. En el siguiente post [...]]]></description>
			<content:encoded><![CDATA[<p>En este segundo post vamos a ver lenguajes para el modelado de protocolos criptográficos.  Con la ayuda de estos lenguajes, seremos capaces de crear un modelo del protocolo para analizarlo mediante ProVerif.</p>
<p>Empezamos con una manera informal de definir protocolos, seguimos con <em>spi-calculus</em>, y finalmente vemos la sintaxis concreta de ProVerif. En el siguiente post tocará ver cómo modelamos los objetivos de los que hablamos en el post anterior, y en el último veremos paso por paso un modelo concreto.</p>
<p><span id="more-87"></span></p>
<p><strong>Narraciones informales</strong></p>
<p>Veamos primero como narrar de forma informal los protocolos criptográficos. En primer lugar, necesitamos una serie de primitivas para definir los mensajes:</p>
<ul>
<li>Tuplas: (m1,m2,...,mn)</li>
<li>Cifrado simétrico: { M }k</li>
<li>Cifrado asimétrico: {| M |}pk</li>
<li>Hashes: #( )</li>
</ul>
<p>Además de esto, necesitamos <em>nonces</em>, que son números de un sólo uso que (en nuestro modelo) son imposibles de adivinar, y claves, que también asumimos inadivinables.</p>
<p>Con esto, podemos por ejemplo modelar el siguiente protocolo:</p>
<p>A-&gt;B: (M,A)<br />
B-&gt;A: N<br />
A-&gt;B: {| #(M,B,N) |}sA</p>
<p>Donde sA es la clave privada de A para realizar firmas criptográficas y N es un <em>nonce</em> que B genera para que la firma de A sea válida solo una vez. En caso de no usar ese <em>nonce</em>, la firma podría haber sido mandada por un atacante ( <em>replay atack</em> ). Imagina este protocolo:</p>
<p>A-&gt;B: (M,A)<br />
B-&gt;A: Sign<br />
A-&gt;B: {| #(M,B) |}sA</p>
<p>En lugar de un <em>nonce</em>, B solo pide la firma de A. En este caso, un atacante podría reenvíar lo mismo más tarde...y por ejemplo B es tu banco y M un mensaje "pagame 1.000.000$" ya la hemos liado <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Creo que con esto quedan claras las narraciones informales, que nos definir un protocolo pero dejan muchos detalles implícitos: comprobaciones al recibir los mensajes, número de agentes en el protocolo, quién y cuándo se generan los mensajes (M,N en este caso), etcetera.</p>
<p>Así pues, necesitamos de un formalismo para definir mejor los protocolos de forma que todo quede tan explícito como sea posible: <em>spi-calculus</em>.</p>
<p><strong>Spi-calculus</strong></p>
<p>El lenguaje <em>spi-calculus </em>está definido por una serie de mensajes, procesos que se pueden componer en serie o en paralelo y una <em>semántica operacional</em> que define cómo evolucionan dichos procesos. Por ejemplo, si se tiene un proceso que escribe en un canal dado, y se tiene otro que lee de dicho canal en paralelo en la variable x, entonces la semántica operacional nos dice que en un paso se puede ir de esta construcción a una en la que sustituiremos todos los valores de la variable x detrás de la lectura del canal en el segundo proceso por el valor escrito por el primero.</p>
<p>No voy a explicar aquí todo el <em>spi-calculus</em>, simplemente os dejo este <a href="http://cs.ru.nl/~chaack/teaching/2IF02-Spring08/spi.pdf">link</a> a un resumen del mismo, y ahora pongo un ejemplo porque el parrafo anterior queda bastante confuso. El siguiente fragmento de código sería el equivalente al protocolo anterior:</p>
<p><em>Pinit(a,b,sa)= new m; out net (m,a); inp net x; if x=Sign then out net {| #(m,b) |}<br />
Presp(b,a,pa)=inp net x; split x is (m,a); out net Sign; inp net x; decrypt x is </em><em>{| z |}pa^-1; if z = #(m,b) stop<br />
Pprotocolo = new a;new b;new kpa; new kpb; !Pinit(a,b,enc(kpa)) | !Pinit(b,a,enc(kpb)) | !Presp(b,a,dec(kpa)) | !Presp(a,b,dec(kpb))</em></p>
<p>De esta forma, tenemos que Pinit es un proceso que genera un mensaje, lo manda a la red, espera a recibir <em>Sign</em> y manda a la red una firma sobre el hash de (m,b). <em>Presp</em> realiza la otra parte del protocolo, y <em>Pprotocolo</em> une todo dando los parámetros adecuados para que pueda haber infinitas sesiones donde ambos agentes a y b puedan funcionar tanto de <em>iniciador </em>como de <em>receptor</em>.</p>
<p>Echando un ojo a la semántica operacional, se puede ver que yendo paso a paso podemos <em>ejecutar </em>el protocolo gracias a <em>spi-calculus</em>. Espero que con este ejemplo y el documento con el resumen de la sintaxis y la semántica se medio entienda, aunque realmente no vamos a usar <em>spi-calculus</em> como tal sino una versión modificada que paso a explicar en otro post ya que se está haciendo demasiado largo y queda un poquito sobre el lenguaje usado por ProVerif.</p>
<p>Sé que este post ha podido quedar demasiado teórico y muy resumido, pero lo interesante está por llegar. En el próximo modelaremos el mismo protocolo mediante ProVerif, pero sin añadir objetivos de seguridad al mismo. Después veremos cómo modelar los objetivos y los añadiremos al modelo, para poder comprobar su seguridad.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-i" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-modelado-i/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Verificación de protocolos criptográficos: Introducción</title>
		<link>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-introduccion</link>
		<comments>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-introduccion#comments</comments>
		<pubDate>Sun, 06 Jul 2008 20:00:51 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[Protocol Verification]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=86</guid>
		<description><![CDATA[Como ya debéis saber todos los que me soleis leer, una de las asignaturas que he cursado este cuatrimestre en la TU Eindhoven se llama Verification of security protocols. Cuando posteé el modelo del protocolo de establecimiento de TLS, que era el trabajo con más peso de la asignatura (sobre un 20%), voy a intentar [...]]]></description>
			<content:encoded><![CDATA[<p>Como ya debéis saber todos los que me soleis leer, una de las asignaturas que he cursado este cuatrimestre en la <a href="http://www.tue.nl">TU Eindhoven</a> se llama <em>Verification of security protocols</em>. Cuando posteé el <a href="http://www.limited-entropy.com/tls-handshake-protocol-en-proverif">modelo del protocolo de establecimiento de TLS</a>, que era el trabajo con más peso de la asignatura (sobre un 20%), voy a intentar explicar un poco cómo verificar las propiedades de los protocolos criptográficos.</p>
<p>En este primer post introduciremos las principales propiedades de los protocolos y el modelo que usamos. En el próximo post veremos rápidamente cómo definir protocolos mediante <em>narraciones informales</em>, la sintaxis del lenguaje <em>spi-calculus</em> para modelado de protocolos criptográficos, y la generalización utilizada en ProVerif. Después de esto, vendrá un post sobre cómo modelar las propiedades básicas en <em>spi</em> y ordenar consultas en ProVerif. Finalmente, despiezaremos en un último post una parte del modelo de TLS, sin implementar ningún mensaje opcional ni<br />
resumen de sesiones.</p>
<p><span id="more-86"></span></p>
<p><strong>Objetivos de los protocolos criptográficos</strong></p>
<p>La siguiente lista muestra unos cuantos objetivos básicos en sistemas de seguridad:</p>
<ul>
<li><strong>Confidencialidad: </strong>Este objetivo se traduce en que un atacante no pueda obtener información sobre ciertos datos del protocolo. Existen dos nociones, la <em>estandar</em> que simplemente implica que no se puede obtener el contenido de los mensajes, y otra más <em>fuerte</em> ( <em>non-interference</em> ) que implica que no se puede deducir nada sobre los mensajes, ni siquiera si dos mensajes mandados tienen el mismo contenido.</li>
</ul>
<ul>
<li><strong>Autenticación: </strong>Trata de asegurar que el origen del mensaje es realmente quien dice ser ( autenticación de origen). También existe autenticación de usuario, verificando que un usuario es quien dice ser.</li>
</ul>
<ul>
<li><strong>Integridad: </strong>Asegura que los datos no han sido modificado</li>
</ul>
<ul>
<li><strong>No repudio:</strong> Asegura que el origen de los datos no pueda negar que los haya enviado ( no repudio de origen) o el destino no pueda negar que los haya recibido ( no repudio de destino ).</li>
</ul>
<p>Existen otras metas, pero estas dan una idea del tipo de objetivos que puede tener un protocolo de seguridad.  Por supuesto cada protocolo está pensado para una situación concreta y puede que tenga algunos de estos objetivos o no.</p>
<p><strong>Modelo black box ( Dolev-Yao )</strong></p>
<p>Para poder verificar las propiedades de un protocolo formalmente, necesitamos modelar dicho protocolo de alguna forma. En nuestro caso usaremos el <a href="http://en.wikipedia.org/wiki/Dolev-Yao_threat_model">modelo <em>Dolev-Yao</em></a>. Este modelo asume que la criptografía es perfecta y que el atacante puede interceptar, modificar o eliminar cualquier mensaje transmitido. Es decir, el atacante controla completamente el canal de comunicación.</p>
<p>La criptografía idealizada que asume este modelo tiene como consecuencia que sin la clave no se puede obtener ninguna información al respecto del contenido, ni tampoco modificarlo. Por tanto la integridad de los mensajes está asegurada... aunque no su origen. Además, las claves son imposibles de adivinar o extraer del texto cifrado y los números aleatorios y los hashes son perfectos.</p>
<p>Por tanto, mediante este modelo solo podremos encontrar fallos independientes de la criptografía. Fallos del protocolo en sí, en la lógica o en la interpretación de mensajes cifrados con la misma clave pero distintos formatos, etc</p>
<p>De momento lo dejamos aquí, el próximo post como he dicho al principio, narraciones informales, spi-calculus y spi-calculus genérico de ProVerif.</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-introduccion" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/verificacion-de-protocolos-criptograficos-introduccion/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TLS Handshake protocol en ProVerif</title>
		<link>http://www.limited-entropy.com/tls-handshake-protocol-en-proverif</link>
		<comments>http://www.limited-entropy.com/tls-handshake-protocol-en-proverif#comments</comments>
		<pubDate>Wed, 11 Jun 2008 18:44:35 +0000</pubDate>
		<dc:creator>Eloi Sanfèlix</dc:creator>
				<category><![CDATA[Seguridad]]></category>

		<guid isPermaLink="false">http://www.limited-entropy.com/?p=82</guid>
		<description><![CDATA[Como dije cuando comenté el protocolo de establecimiento de sesión de TLS, en la asignatura Verification of security protocols nos mandaron modelar y analizar la seguridad del mismo mediante la herramienta automatizada ProVerif. Esta semana nos han devuelto las soluciones y como está bastante completa, con la única pega de que modelamos una única continuación [...]]]></description>
			<content:encoded><![CDATA[<p>Como dije cuando comenté el <a href="http://www.limited-entropy.com/analisis-del-protocolo-de-establecimiento-de-tls">protocolo de establecimiento de sesión de TLS</a>, en la asignatura <em>Verification of security protocols</em> nos mandaron modelar y analizar la seguridad del mismo mediante la herramienta automatizada ProVerif.</p>
<p>Esta semana nos han devuelto las soluciones y como está bastante completa, con la única pega de que modelamos una única continuación de cada sesión en lugar de (potencialmente) infinitas, la he subido para quien le pueda interesar. Modificar eso es sencillísimo y solo es añadir un signo de exclamación (replicación infinita del proceso) delante del comando que mete el identificador de sesión en un canal privado a modo de base de datos tanto en el cliente como en el servidor.</p>
<p>Es posible que más adelante escriba una serie de posts sobre cómo funciona ProVerif, o suba un documento que probablemente me haga para mi propio uso antes del examen de esta asignatura, a modo resumen de todo lo dado.</p>
<p>El modelo, <a href="http://www.limited-entropy.com/docs/tls.vosp">aquí</a>. Lo hice conjuntamente con un compañero, pero ha dado permiso para publicarlo en la web del profesor con nuestros nombres y aquí no creo que tenga ningún problema <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>La sintaxis es algo compleja si no se conoce, si estáis interesados podéis consultar <a href="http://cs.ru.nl/~chaack/teaching/2IF02-Spring08/">la web de la asignatura</a>, donde además hay otras dos soluciones; otra opción es esperar a que ponga algún ejemplo explicado más adelante.</p>
<p>Si alguien está interesado que lo diga en los comentarios y así lo tendré presente <img src='http://www.limited-entropy.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> .</p>
<div id="flaresmith" class="feedflare"><script src="http://feeds.feedburner.com/~s/LimitedEntropyDotCom?i=http://www.limited-entropy.com/tls-handshake-protocol-en-proverif" type="text/javascript" charset="utf-8"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.limited-entropy.com/tls-handshake-protocol-en-proverif/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
