<?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"
	>

<channel>
	<title>novolocus.com &#187; Security</title>
	<atom:link href="http://www.novolocus.com/category/security/feed" rel="self" type="application/rss+xml" />
	<link>http://www.novolocus.com</link>
	<description>Whatever Andy Burns is working on...</description>
	<pubDate>Tue, 18 Nov 2008 12:00:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>RSA SecurID and SharePoint</title>
		<link>http://www.novolocus.com/2008/09/16/rsa-securid-and-sharepoint/</link>
		<comments>http://www.novolocus.com/2008/09/16/rsa-securid-and-sharepoint/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 09:50:35 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[RSA]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=770</guid>
		<description><![CDATA[I&#8217;d an interesting question from a customer the other day - they wanted Forms Authentication on extranet access to SharePoint, but using two factor authentication. The product mentioned was RSA SecurID, and this means that to authenticate yourself you need:

Your Username
A hardware device that shows a pseudo-randomly generated PIN number which changes every minute or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d an interesting question from a customer the other day - they wanted Forms Authentication on extranet access to SharePoint, but using two factor authentication. The product mentioned was <a href="http://www.rsa.com/node.aspx?id=1156">RSA SecurID</a>, and this means that to authenticate yourself you need:</p>
<ul>
<li>Your Username</li>
<li>A hardware device that shows a pseudo-randomly generated PIN number which changes every minute or so.</li>
</ul>
<p>&#8216;Cos the PIN is a pseudo-random sequence, if the token and a server are in sync, you can validate that someone has read that token inside the last minute.  It&#8217;s an expensive technology - but neat!</p>
<p>The idea is the same as, say, a credit card. More than just saying who I am and that I have some piece of knowledge (e.g. my PIN number), I also have to have a physical object which is hard to duplicate (my credit card). This should make my identity more certain.</p>
<p>Anyway, how does this fit with SharePoint? <span id="more-770"></span></p>
<p>The short answer is, it doesn&#8217;t. This technology works with and ISA server/Firewall, which is well in front of any SharePoint system. Obviously, this doesn&#8217;t stop you using it, but it does mean that you have to log in twice - once to get past the RSA security on the firewall or ISA server, and then once to log in to SharePoint - though this second part is almost more so that SharePoint knows who you are.</p>
<p>Still, it&#8217;s easy to imagine that single sign-on would be desirable - is it possible? Well, I found these excellent posts by Pranab Paul:</p>
<ul>
<li><a href="http://blogs.msdn.com/pranab/archive/2008/02/07/sharepoint-2007-moss-wss-fba-and-rsa-unanswered-questions.aspx">SharePoint 2007 (MOSS/WSS) FBA and RSA - Unanswered Questions</a></li>
<li><a href="http://blogs.msdn.com/pranab/archive/2007/12/13/using-http-module-for-sharepoint-2007-moss-wss-site-using-fba-and-rsa.aspx">Using HTTP Module for SharePoint 2007 (MOSS/WSS) site using FBA And RSA</a></li>
</ul>
<p><em>(Note: this is backwards - it makes more sense this way around!)</em></p>
<p>The short in-case-his-blog-vanishes description is that the RSA system adds an RSA cookie to the HTTP Request after the user has been authenticated. Pranab had a database of SQL database of the external users with the same name as sent by the RSA system, so he picked up the username from the RSA cookie, and logged the user in!</p>
<p>Now, this did slightly nerd log-out (which would automatically log the user back in), and &#8217;sign on as a different user&#8217;, so his second post details an HTTP module to handle this (i.e. remove the RSA cookie for the signout/access denied pages).</p>
<p>Very cool. Unfortunately, I&#8217;m not convinced the customer will go for this when they realise that it means that external users will need some hardware token to gain access. Yeah, I know, that&#8217;s the point, but you can see the &#8216;but I want access and I left my token at work/home/in the car/bath, etc.&#8217;.</p>
<p>Finally, some more links:</p>
<ul>
<li><a href="http://blogs.technet.com/isablog/archive/2008/02/07/walk-through-for-rsa-securid-authentication-for-isa-server-2006-part-1-rsa-authentication-manager-server-configuration.aspx">Walk-through for RSA SecurID Authentication for ISA Server 2006 Part 1</a></li>
<li><a href="https://blogs.technet.com/isablog/archive/2008/02/07/walk-through-for-rsa-securid-authentication-for-isa-server-2006-part-2-isa-array-members-preparation.aspx">Walk-through for RSA SecurID Authentication for ISA Server 2006 Part 2</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2008/09/16/rsa-securid-and-sharepoint/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Threat Modelling at Microsoft - an example</title>
		<link>http://www.novolocus.com/2007/10/01/threat-modelling-at-microsoft-an-example/</link>
		<comments>http://www.novolocus.com/2007/10/01/threat-modelling-at-microsoft-an-example/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 11:10:42 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=27</guid>
		<description><![CDATA[Interesting - Larry Osterman explains how MS do threat analysis (in lots of parts). Found on Bruce Schneier&#8217;s Blog. Worth a read - certainly it&#8217;s made me think about the stuff I&#8217;ve written.
Parts 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
]]></description>
			<content:encoded><![CDATA[<p>Interesting - Larry Osterman explains how MS do threat analysis (in lots of parts). Found on <a href="http://www.schneier.com/blog/archives/2007/10/threat_modeling.html">Bruce Schneier&#8217;s Blog</a>. Worth a read - certainly it&#8217;s made me think about the stuff I&#8217;ve written.</p>
<p>Parts <a href="http://blogs.msdn.com/larryosterman/archive/2007/08/30/threat-modeling-once-again.aspx">1</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/08/31/threat-modeling-again-drawing-the-diagram.aspx">2</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/04/threat-modeling-again-stride.aspx">3</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/05/threat-modeling-again-stride-mitigations.aspx">4</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/07/threat-modeling-again-what-does-stride-have-to-do-with-threat-modeling.aspx">5</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/10/threat-modeling-again-stride-per-element.aspx">6</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/11/threat-modeling-again-threat-modeling-playsound.aspx">7</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/13/threat-modeling-again-analyzing-the-threats-to-playsound.aspx">8</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/14/threat-modeling-again-pulling-the-threat-model-together.aspx">9</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/17/threat-modeling-again-presenting-the-playsound-threat-model.aspx">10</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/18/threat-modeling-again-threat-modeling-in-practice.aspx">11</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/19/threat-modeling-again-threat-modeling-and-the-firefoxurl-issue.aspx">12</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/21/threat-modeling-again-threat-modeling-rules-of-thumb.aspx">13</a>, <a href="http://blogs.msdn.com/larryosterman/archive/2007/09/21/threat-modeling-again-threat-modeling-rules-of-thumb.aspx">14</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2007/10/01/threat-modelling-at-microsoft-an-example/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Abject Failure and Complexity</title>
		<link>http://www.novolocus.com/2007/09/26/abject-failure-and-complexity/</link>
		<comments>http://www.novolocus.com/2007/09/26/abject-failure-and-complexity/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 16:09:13 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=31</guid>
		<description><![CDATA[I&#8217;ve been meaning to post this for ages - Marus Ranum on why information security is an abject failure. And he&#8217;s right - the problem is the complexity of todays interactions, both at a protocol and language level.
To me, the problem is one of failure of KISS (Keep It Simple, Stupid). Applications and protocols haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to post this for ages - Marus Ranum on why information security is an <a href="http://www.ranum.com/security/computer_security/editorials/failure/index.html">abject failure</a>. And he&#8217;s right - the problem is the complexity of todays interactions, both at a protocol and language level.</p>
<p>To me, the problem is one of failure of KISS (<u>K</u>eep <u>I</u>t <u>S</u>imple, <u>S</u>tupid). Applications and protocols haven&#8217;t been, and we&#8217;ve had more tacking together of technologies, and expansion of complexity of everything.</p>
<p>I mean, consider what languages you needed to know 10 years ago, and now:</p>
<p>Then:</p>
<p><strong>HTML 3.2, JavaScript</strong> maybe, <strong>Perl</strong> if you&#8217;re brave, <strong>SQL</strong> if you&#8217;re a hero.</p>
<p>Now (Microsoft Stack only):</p>
<p><strong>HTML 3.4, 4 </strong> (various favours), <strong>XHTML, XML, XSL, XPATH, JavaScript</strong> (much more complex), <strong>ASP.NET 2.0, C# or VB, .NET frameworks 1.1, 2, 3 and 3.5</strong> (soon), <strong>ADO, SQL, CSS, &#8216;AJAX&#8217;</strong></p>
<p>That&#8217;s just the languages and base technologies - never mind getting into a higher level of software (e.g. SharePoint). Or non-MS technologies - Ruby, Rails, Python, Java in various forms&#8230;</p>
<p>It&#8217;s similar in protocols&#8230;</p>
<p>Then:</p>
<p><strong>HTTP, HTTPS, FTP, SMTP / POP</strong></p>
<p>Now:</p>
<p><strong>HTTP, HTTPS, FTP, SMTP / POP, SOAP, Web Services (plus various extensions), IMAP, Various Peer-To-Peer protocols, Various Instant Messaging protocols </strong></p>
<p>(Yes, those are fairly high level, and from different levels of the stack - but still, you&#8217;re expected to know about them.) (And yes, I suppose you&#8217;d need to know a bit about TCP/IP and IPSEC)</p>
<p>Does that sound simple? Does my granny skateboard?</p>
<p>(Well, no, but that would be <em>so</em> cool).</p>
<p>Security will be impossible with such a complex, varied stack of technologies, and developers simply won&#8217;t be able to specialise enough to know how to make secure enough applications. It alarms me how wrong <a href="http://www.codinghorror.com/blog/archives/000953.html">people are getting password storage</a> alone - I mean, this stuff has been known since the 70&#8217;s. If they can&#8217;t get that right, how will they manage with a such a deep and varied set of tools?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2007/09/26/abject-failure-and-complexity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Benchmark: Speed of Encryption and Decryption using .NET Framework classes</title>
		<link>http://www.novolocus.com/2007/01/03/benchmark-speed-of-encryption-and-decryption-using-net-framework-classes/</link>
		<comments>http://www.novolocus.com/2007/01/03/benchmark-speed-of-encryption-and-decryption-using-net-framework-classes/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 10:01:16 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=109</guid>
		<description><![CDATA[I was reading about security stuff in the .NET framework, and dealing with cryptographic classes in it, and it sort of set me wondering. Here are all these different encryption classes, with different block and keys sizes, cipher modes, all that jazz - but what are their performances like? Specifically, I&#8217;d read something saying how [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading about security stuff in the .NET framework, and dealing with cryptographic classes in it, and it sort of set me wondering. Here are all these different encryption classes, with different block and keys sizes, cipher modes, all that jazz - but what are their performances like? Specifically, I&#8217;d read something saying how some &#8216;weaker&#8217; encryption algorithms are better  (in some speed-critical applications) &#8216;cos they&#8217;re faster. I wondered how much?</p>
<p>Thus, I decided to benchmark the <a href="http://en.wikipedia.org/wiki/Symmetric_cipher">Symmetric alogrithms</a> in the .NET Framework - <a href="http://en.wikipedia.org/wiki/Data_Encryption_Standard">DES</a>, <a href="http://en.wikipedia.org/wiki/Triple_DES">Triple DES</a>, <a href="http://en.wikipedia.org/wiki/RC2">RC2</a> and <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard">Rijndael</a>. To make life interesting, I thought I&#8217;d try them with differenct <a href="http://en.wikipedia.org/wiki/Key_length">key sizes</a> and <a href="http://en.wikipedia.org/wiki/Block_size_%28cryptography%29">block sizes</a>, and <a href="http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation">cipher modes</a>.</p>
<p>So, I&#8217;ve linked to definitions of these factors, but for those who don&#8217;t want to read vast chunks of Wikipedia, here are my (simplified) definitions. For anyone really interested in learning how to program with encryption properly (and in learning why their 128 bit key probably isn&#8217;t 128 bits strong) I can <em>strongly</em> recommend the book <a href="http://www.amazon.co.uk/Practical-Cryptography-N-Ferguson/dp/0471223573/sr=8-1/qid=1167826189/ref=pd_ka_1/202-1250360-5295854?ie=UTF8&amp;s=books">&#8216;Practical Cryptography&#8217;</a> by <a href="http://www.schneier.com/blog/">Bruce Schneier</a> and Niels Ferguson.</p>
<p><em><strong>Symmetric ciphers</strong></em> are ones like you used when you were a kid. You have some operation that turns a message into garbage, and then the reverse of that operation turns that garbage into a message. Some algorithms don&#8217;t have a reverse - they are asymmetric ciphers, and are a whole different <a href="http://www.worldwidewords.org/qa/qa-ket1.htm">kettle of fish</a>.</p>
<p><em><strong>Keys</strong></em> are the password you use with your cipher. For example, if you&#8217;re cipher as a kid was to shift all letters in the alphabet, then the key might be the numbers of characters shifted. Big keys are harder to break. Think of it as being just like a password or PIN number. If I tell you that my PIN is 4 digits, you might be tempted to guess all 10,000 possibilities, and on average you&#8217;d figure my PIN out after 5000 tries. If my PIN was 8 digits, then there is 100,000,000 options - and you&#8217;re less likely to try all the possibilities, eh?</p>
<p><em><strong>Block sizes</strong></em>. Well, okay, some ciphers work on blocks of data, rather than each byte (or each &#8216;letter&#8217;). These are block ciphers. There are also stream ciphers, where each byte is encrypted one by one. Anyway, in block ciphers there is a limit to how much data can be encrypted without &#8216;leaking&#8217; information. Larger block sizes can encrypt more data without that leakage. (That&#8217;s not to say that the block has been decrypted, but an attacker could start to learn things about the contents of that block.)</p>
<p><em><strong>Cipher modes</strong></em> don&#8217;t really have a parallel with how you did codes as a kid. I guess I would describe it that if the cipher is about how you make an apparently random set of bits, then the cipher mode is about how you then use them. There are lots of different modes, but the .NET framework classes only seem to support 3 - ECB (Electronic Cookbook), CBC (Cipher block chaining) and CFB (Cipher Feedback).</p>
<p>So, what are the algorithms:</p>
<ul>
<li>DES - An old encryption standard, now regarded as offering poor security, but so widely used that it is still in operation as a legacy system.</li>
<li>Triple DES - An improved version of DES, made by essentially applying the DES 3 times.</li>
<li>RC2 - A moderately old encryption algorithm. Flexible key lengths, but short block size.</li>
<li>Rijndael (aka AES) - The latest encryption standard. The Rijndael algorithm was selected from several as part of a competition. It wasn&#8217;t regarded as the most secure, but it was quite quick. The Advanced Encryption Standard (AES) is actually a <a href="http://www.novolocus.com/display.php?id=360">subset of Rijndael</a>.</li>
</ul>
<p><strong>The Test</strong></p>
<p>I found a nice text file - &#8220;The complete works of Shakespeare&#8221; - as my test data.</p>
<p>For each algorithm, for each mode, key and block size, the test program encrypted and decrypted the data twenty times, and reported the average &#8216;time&#8217; for each operation. I was using the Win32 QueryPerformanceCounter function, which doesn&#8217;t really return a time so much as cycles. However, all the tests were done on the same machine, so they&#8217;ll do just fine for comparison purposes.</p>
<p><strong>Results</strong></p>
<p>With the several factors tested, there are many ways of slicing the data. It&#8217;s worth noting that these results are pretty rough, as the times taken also include file IO operations, and with any modern PC there&#8217;s also something else happening at any single time. Also, the times are the total time taken to encrypt and decrypt, which might not be the same for each operation. Treat the results as a loose guide.</p>
<p>First let&#8217;s look at the raw results. <a href="http://www.novolocus.com/files/EncryptionTimes.xls">You can get the results here (Excel file)</a>.</p>
<p>Unsurprisingly, DES is fastest - given it&#8217;s age, and the low level of security it offers now. Triple DES with the longest key it supports was generally slowest. RC2 covered the full range of results, which is also unsurprising, given it&#8217;s flexibility, and Rijndael sort of falls in the middle.</p>
<p><img src="http://www.novolocus.com/wp-content/oldImages/62.png" border="1" /></p>
<p>The first thing I noticed was how few tests there were using DES or Triple DES. RC2 and Rijndael are much more flexible in their use.</p>
<p>Next, it&#8217;s interesting to note that RC2, DES and Triple DES using Cipher Feedback Mode (CFB) were all very, very slow. They all seem to suffer very badly using CFB.</p>
<p><img src="http://www.novolocus.com/wp-content/oldImages/64.png" border="1" /></p>
<p>So, excluding the CFB results then (as they are so exceptionally slow), what do the other results show? Well, Rijndael does not suffer so badly in CFB, although CFB is slower.</p>
<p><img src="http://www.novolocus.com/wp-content/oldImages/63.png" border="1" /></p>
<p>ECB appears slightly slightly faster in the table, though examining the CBC Mode Graph shows little difference.</p>
<p><img src="http://www.novolocus.com/wp-content/oldImages/65.png" border="1" /></p>
<p>To compare the modes, I looked at just the operations done with the Rijndael cipher.</p>
<p><img src="http://www.novolocus.com/wp-content/oldImages/66.png" border="1" /></p>
<p>Again, we see little difference between ECB and CBC, so I guess there&#8217;s no reason not to use the more secure CBC mode over ECB (for an example of it&#8217;s weakness <a href="http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_.28ECB.29">see here</a>). Also, for 128 bit blocks (as required by the AES standard), CFB is as quick as ECB.</p>
<p>Rijndael is not great in CFB mode with blocks of longer than 128 bits.</p>
<p>Okay, so let&#8217;s focus on just one mode (CBC) and look at the results shown in the CBC Mode Graph. Well, it&#8217;s interesting to note that RC2 with a 112 bit key was quite quick - faster than with some shorter keys. However, it&#8217;s only about 6.5% longer to use 128 bit Rijndael - which is a key that is 14% longer. Doubling the key with Rijndael to 256 was only 10% longer than 128.</p>
<p>Longer blocks take longer to encrypt and decrypt. 64 bit blocks seems a little short these days, only being safe for up to a couple of hundred megabytes. 128 bits seems more reasonable. 256 bits seems excessive. Rijndael seems to have little penalty for using 256 bits over 128, though if you do, you&#8217;re not using an AES standard encryption.</p>
<p><strong>Conclusion</strong></p>
<p>DES and Triple DES are old. DES isn&#8217;t secure, and Triple DES doesn&#8217;t seem to offer much given Rijndael and RC2 being much faster than it.</p>
<p>In terms of cipher modes, these classes only seem to support ECB, CFB anc CBC. ECB is generally regarded as being a poor mode - it&#8217;s not very secure. CFB was typically slower than CBC, and as Microsoft have already implemented the classes, some of the advantages CFB (i.e. encryption and decryption being identical operations) have been lost.</p>
<p>So, then examining Rijndael in CBC mode, well, there is little penalty for using 256 bit keys or 256 bit blocks. However, it&#8217;s probably worth sticking to 128 bit blocks as 1) it is plenty, and 2) it is AES compatible.</p>
<p>All in all, I was surprised by how similar a lot of the results were for different algorithms, and I was surprised by how slow some of the CFB mode operations were.</p>
<p>To be honest, I can&#8217;t really think of a reason not to use Rijndael with 128 bit blocks, in CBC mode. Unless time is a really critical factor, 256 bit keys are stronger. Finally, the <em>RijndaelManaged</em> class in the framework is a managed class, rather than a wrapper for a COM object.</p>
<p>So, the winner is Rijndael!</p>
<p class="oldCommentOuter">Comments from my old blog:</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">This is a very informative article. I have just started looking into  encryption, and I have come across nothing on the internet that is as concise as your article.<br />
Will you be doing something similar with asymmetric encryption as well?</p>
<p class="oldCommentFooter">By Firoz at 06:22:04 Friday 9th February 2007</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">Yup, well, at some point. The truth is, in the .NET 2.0 framework, there isn&#8217;t a lot of other asymmetric algorithms. RSA is about it. I think in the .NET 3.0 framework there is elliptical curve, and that would be interesting&#8230;</p>
<p>So, yes, when I get around to it.</p>
<p class="oldCommentFooter">By Andy B at 10:09:43 Friday 13th April 2007</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2007/01/03/benchmark-speed-of-encryption-and-decryption-using-net-framework-classes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AES and Rijndael - AES is a subset&#8230;</title>
		<link>http://www.novolocus.com/2006/12/28/aes-and-rijndael-aes-is-a-subset/</link>
		<comments>http://www.novolocus.com/2006/12/28/aes-and-rijndael-aes-is-a-subset/#comments</comments>
		<pubDate>Thu, 28 Dec 2006 14:12:09 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=111</guid>
		<description><![CDATA[Useful article from the .NET Security blog about AES and Rijndael. Essentially, Rijndael is more flexible than it&#8217;s use as defined in the AES standard. Can&#8217;t say I&#8217;ve ever come across a situation where I&#8217;d want to less than 256 bit, but then I&#8217;ve never had to do time critical encryption. Might benchmark it, that [...]]]></description>
			<content:encoded><![CDATA[<p>Useful article from the <a href="http://blogs.msdn.com/shawnfa/archive/2006/10/09/The-Differences-Between-Rijndael-and-AES.aspx">.NET Security blog</a> about AES and Rijndael. Essentially, Rijndael is more flexible than it&#8217;s use as defined in the AES standard. Can&#8217;t say I&#8217;ve ever come across a situation where I&#8217;d want to less than 256 bit, but then I&#8217;ve never had to do time critical encryption. Might benchmark it, that might be an interesting task.</p>
<p>The short of it is:</p>
<p class="insetB" width="75">
Essentially, if you want to use RijndaelManaged as AES you need to make sure that:</p>
<ol>
<li>The block size is set to 128 bits</li>
<li>You are not using CFB mode, or if you are the feedback size is also 128 bits</li>
<li><em>The key size is 128, 192 or 256 bits (Added by Andy)</em></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/28/aes-and-rijndael-aes-is-a-subset/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RSACryptoServiceProvider - &#34;Key not valid for use in specified state&#34;</title>
		<link>http://www.novolocus.com/2006/12/21/rsacryptoserviceprovider-key-not-valid-for-use-in-specified-state/</link>
		<comments>http://www.novolocus.com/2006/12/21/rsacryptoserviceprovider-key-not-valid-for-use-in-specified-state/#comments</comments>
		<pubDate>Thu, 21 Dec 2006 15:12:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=113</guid>
		<description><![CDATA[So, I was trying to do some encrypted comms over TCP, only rather than using SSL, I thought I&#8217;d try to RSA encrypt and decrypt at client and server myself. I know, it&#8217;s re-inventing the wheel - the point is to get to know the APIs though, and it seemed a good exercise.
I started getting [...]]]></description>
			<content:encoded><![CDATA[<p>So, I was trying to do some encrypted comms over TCP, only rather than using SSL, I thought I&#8217;d try to RSA encrypt and decrypt at client and server myself. I know, it&#8217;s re-inventing the wheel - the point is to get to know the APIs though, and it seemed a good exercise.</p>
<p>I started getting an error though - &#8220;Key not valid for use in specified state&#8221;. Odd. I was importing the key from an XML file, using the FromXMLString() function. It all seemed to work just fine. So, WTF? It&#8217;s not like the code is complicated:</p>
<p><code>RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();<br />
rsa.FromXmlString(publickey);<br />
byte[] encryptedData = rsa.Encrypt(data, false);</code></p>
<p>So what gives?</p>
<p>Well, eventually, I tracked it back to this - I was trying to send too much data. Not very much - less than a couple of hundred bytes - but this was too much.</p>
<p>The obvious thing to do was change the way this works to match the way it&#8217;s supposed to work - use RSA encryption to transfer the key to a block cipher, and then encrypt all your data with that block cipher. But I couldn&#8217;t be arsed - I just wanted to see the asymetric encryption work - so I reduced my data&#8230;</p>
<p class="oldCommentOuter">Comments from my old blog:</p>
<p class="oldCommentInner">
<p class="oldComment">Sounds like you where in the 70-536 Self Study book from Microsoft. In chapter 12 doing some suggested practices.</p>
<p>Anyway.. that&#8217;s where I am and your message here on the blog helped.</p>
<p>I too will send a smaller file <img src='http://www.novolocus.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p class="oldCommentFooter">By Micke at 17:13:02 Monday 24th September 2007</p>
<p class="oldCommentInner">
<p class="oldComment">Yup, I think I was. It was a bit daft that they didn&#8217;t mention the limits on the size of the data.</p>
<p>But that book has a _lot_ of issues.</p>
<p class="oldCommentFooter">By Andy at 10:18:03 Thursday 27th September 2007</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/21/rsacryptoserviceprovider-key-not-valid-for-use-in-specified-state/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Creating Test Certificates with MakeCert</title>
		<link>http://www.novolocus.com/2006/12/18/creating-test-certificates-with-makecert/</link>
		<comments>http://www.novolocus.com/2006/12/18/creating-test-certificates-with-makecert/#comments</comments>
		<pubDate>Mon, 18 Dec 2006 11:12:17 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<category><![CDATA[Web Servers]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=114</guid>
		<description><![CDATA[I was having a bugger of a time setting up an SSL connection using a test certificate until I found this article by John Howard. One thing I would say - when using MMC to look for newly created certificates, remember to &#8216;refresh&#8217; the view. Otherwise this works - shame I don&#8217;t entirely understand how&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>I was having a bugger of a time setting up an SSL connection using a test certificate until I found <a href="http://blogs.technet.com/jhoward/archive/2005/02/02/365323.aspx">this article by John Howard</a>. One thing I would say - when using MMC to look for newly created certificates, remember to &#8216;refresh&#8217; the view. Otherwise this works - shame I don&#8217;t entirely understand how&#8230; &#8230; still, at least my error &#8220;The server mode ssl must use a certificate with the associated private key&#8221; is now gone&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/18/creating-test-certificates-with-makecert/feed/</wfw:commentRss>
		</item>
		<item>
		<title>No Logins&#8230;</title>
		<link>http://www.novolocus.com/2005/08/31/no-logins/</link>
		<comments>http://www.novolocus.com/2005/08/31/no-logins/#comments</comments>
		<pubDate>Wed, 31 Aug 2005 15:08:39 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[General Tech]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=227</guid>
		<description><![CDATA[What an interesting idea - no login/passwords, just a hard to quess URL. Provided that there&#8217;s nothing very valuable there, this seems a simple way of giving adequate security for some things - such as the invites app mentioned. I like it.
Comments from my old blog:

What about Search Engine&#8217;s spidering it?  Of course you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>What an interesting idea - no login/passwords, just <a href="http://37signals.com/svn/archives2/url_or_username_and_password.php">a hard to quess URL</a>. Provided that there&#8217;s nothing very valuable there, this seems a simple way of giving adequate security for some things - such as the invites app mentioned. I like it.</p>
<p class="oldCommentOuter">Comments from my old blog:</p>
<p class="oldCommentInner">
<p class="oldComment">What about Search Engine&#8217;s spidering it?  Of course you&#8217;ll want to include a &lt;META NAME=&#8221;ROBOTS&#8221; CONTENT=&#8221;NOINDEX, NOFOLLOW&#8221;&gt;, but even then, I&#8217;ve read that certain search engines like askjeeves.com IGNORE those tags.</p>
<p>Brandon@Cstone</p>
<p class="oldCommentFooter">By Brandon@Cstone at 04:12:01 Thursday 29th September 2005</p>
<p class="oldCommentInner">
<p class="oldComment">Well, I guess as you say it&#8217;ll have to be for urls that aren&#8217;t linked to anywhere. The URL itself is sent out by email in the example. That&#8217;s my guess anyway.</p>
<p class="oldCommentFooter">By Andy at 21:43:46 Saturday 19th November 2005</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/08/31/no-logins/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Secure PHP</title>
		<link>http://www.novolocus.com/2005/07/29/secure-php/</link>
		<comments>http://www.novolocus.com/2005/07/29/secure-php/#comments</comments>
		<pubDate>Fri, 29 Jul 2005 13:07:50 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=231</guid>
		<description><![CDATA[So, I took time out from decorating to trawl the Internet, as is my wont. I came across a nice site with Apache Mod_Rewrite cheat sheets which is nerdy, but useful. The same site also has a nice article about Writing Secure PHP which is pretty good - although I have some comments&#8230;
So I&#8217;m a [...]]]></description>
			<content:encoded><![CDATA[<p>So, I took time out from decorating to trawl the Internet, as is my wont. I came across a nice site with <a href="http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/">Apache Mod_Rewrite cheat sheets</a> which is nerdy, but useful. The same site also has a nice article about <a href="http://www.ilovejackdaniels.com/security/writing-secure-php-3/comments">Writing Secure PHP</a> which is pretty good - although I have some comments&#8230;<span id="more-231"></span></p>
<p>So I&#8217;m a nerd for security, and I do like overkill, but there are some simple things that could be done to improve the security described in the &#8216;Weak Passwords&#8217; section on page 2.</p>
<p>First off, don&#8217;t use MD5. <a href="http://www.schneier.com/blog/archives/2005/06/more_md5_collis.html">It&#8217;s broken</a> , or at least it would be better (and very little effort) to use <a href="http://uk.php.net/manual/en/function.sha1.php">SHA-1</a>.</p>
<p>Second, if you&#8217;re storing the hash (MD5, SHA-1, SHA-256, whatever) of a user&#8217;s password, well, don&#8217;t just hash the password, but hash the username too. <a href="http://uk.php.net/manual/en/function.crypt.php">PHP&#8217;s Crypt()</a> function is for this kind of thing, with a &#8217;salt&#8217;. E.g.<br />
<code>Function EncryptPassword( $username, $password ) {<br />
	$salt = substr($username,0,2);<br />
	return crypt($password, $salt);<br />
}</code><br />
What would this mean? Well, an attacker trying the dictionary attack described would need not 1, but 3844 dictionaries, assuming usernames are alphanumeric and case sensitive.</p>
<p>Hell, why not use the username too as what you&#8217;re hashing? I&#8217;ve not seen this done anywhere - and I&#8217;m not <em>sure</em> of it&#8217;s security (I say that in the most paranoid sense) - but principle is the same. By appending the username to the password being hashed, well, you&#8217;d need a seperate dictionary for each username. You could even throw in a constant string - it doesn&#8217;t add much security, but it means your code would have to be compromised in order to allow precomputation of a dictionary for a user.<br />
<code>Function MakeHash( $username, $password ){<br />
      return sha1( $username . "some arbitrary string" . $password);<br />
}</code><br />
A final thought - don&#8217;t underestimate passphrases rather than passwords. They&#8217;re easier for people to remember than passwords. Consider &#8216;r5GG8%&#8217; and &#8216;elephants lollop gracefully&#8217;. Which would you remember? <a href="http://blogs.technet.com/robert_hensing/archive/2004/07/28/199610.aspx">Robert Hessig of Microsoft PSS</a> has a good article. And all of the above techniques would work with a passphrase instead of password - after all, they&#8217;re all just text&#8230;</p>
<p class="oldCommentOuter">Comments from my old blog:</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">DES was broken many years ago, so that&#8217;s a very poor alternative to MD5.</p>
<p class="oldCommentFooter">By Chris at 16:18:01 Saturday 30th July 2005</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">Puzzled by the DES comment - DES isn&#8217;t a good algorithm for encryption, certainly - it&#8217;s bust, and we have AES now. Also, DES is a block encryption cipher, whereas MD5 is a hashing algorithm. Different things.</p>
<p class="oldCommentFooter">By Andy at 21:50:29 Saturday 19th November 2005</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">I believe the DES comment is because your EncryptPassword function passes crypt a two character salt, which makes crypt use the &#8217;standard DES-based encryption&#8217;.</p>
<p class="oldCommentFooter">By Deebster at 16:41:44 Wednesday 29th March 2006</p>
<p class="oldCommentInner">&nbsp;</p>
<p class="oldComment">Ah, well I&#8217;ll be damned. I hadn&#8217;t realised that Crypt could use DES. Come to that, I&#8217;m not sure why I&#8217;m using a Crypt function for what should be hashing. Brain fade, I guess. I suppose that replacing DES with Blowfish would give a function that encrypted the password in a recoverable way, although I&#8217;m not a fan of that.</p>
<p class="oldCommentFooter">By Andy at 12:28:55 Saturday 6th May 2006</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/07/29/secure-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Securing MySQL</title>
		<link>http://www.novolocus.com/2005/06/28/securing-mysql/</link>
		<comments>http://www.novolocus.com/2005/06/28/securing-mysql/#comments</comments>
		<pubDate>Tue, 28 Jun 2005 07:06:26 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=244</guid>
		<description><![CDATA[Securing MySQL at Sitepoint. Particularly relevant, and something I need to refresh on - here&#8217;s an article at MySQL AB, and Securityfocus. Bit Unix-y (we use all Windows at work) but lots is still pertinent&#8230;
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sitepoint.com/blog-post-view?id=275986">Securing MySQL</a> at Sitepoint. Particularly relevant, and something I need to refresh on - <a href="http://dev.mysql.com/doc/mysql/en/security-against-attack.html">here&#8217;s an article at MySQL AB</a>, and <a href="http://www.securityfocus.com/infocus/1726">Securityfocus</a>. Bit Unix-y (we use all Windows at work) but lots is still pertinent&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/06/28/securing-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rico, and more Ajax</title>
		<link>http://www.novolocus.com/2005/06/19/rico-and-more-ajax/</link>
		<comments>http://www.novolocus.com/2005/06/19/rico-and-more-ajax/#comments</comments>
		<pubDate>Sun, 19 Jun 2005 18:06:20 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=251</guid>
		<description><![CDATA[Rico looks like a very promising library of Javascript. I&#8217;ve downloaded it, but not had a play yet.
An interesting validation technique
Encryption in Javascript. I&#8217;m sure I&#8217;ll think of a use eventually, but it just seems a neat idea to link with Ajax philosophy. I mean, with AES and the like, you can get the user [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.openrico.org/home.page">Rico</a> looks like a very promising library of Javascript. I&#8217;ve downloaded it, but not had a play yet.</p>
<p><a href="http://particletree.com/features/smart-validation-with-ajax">An interesting validation technique</a></p>
<p><a href="http://home.zonnet.nl/MAvanEverdingen/Code/">Encryption in Javascript</a>. I&#8217;m sure I&#8217;ll think of a use eventually, but it just seems a neat idea to link with Ajax philosophy. I mean, with AES and the like, you can get the user to enter password, and there are uses for symmetric key algorithms.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/06/19/rico-and-more-ajax/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Neat idea to make login more secure</title>
		<link>http://www.novolocus.com/2005/04/06/neat-idea-to-make-login-more-secure/</link>
		<comments>http://www.novolocus.com/2005/04/06/neat-idea-to-make-login-more-secure/#comments</comments>
		<pubDate>Wed, 06 Apr 2005 08:04:08 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=282</guid>
		<description><![CDATA[Key and mouse loggers are devices that do just that - log the keys a user presses, or the xy position of a mouse. This can also capture passwords, or options selected from web pages with the mouse if used instead of passwords.
So, here is a neat idea - scramble the buttons you need to [...]]]></description>
			<content:encoded><![CDATA[<p>Key and mouse loggers are devices that do just that - log the keys a user presses, or the xy position of a mouse. This can also capture passwords, or options selected from web pages with the mouse if used instead of passwords.</p>
<p>So, here is a neat idea - scramble the buttons you need to input for each session.</p>
<p>From <a href="http://www.schneier.com/blog/archives/2005/04/police_foil_ban_1.html">Bruce Schneier&#8217;s Website</a></p>
<p class="insetb">If you own the box, you have mouse clicks, yes, but are you recording them? And are you also recording information about what&#8217;s being written to the display?Here&#8217;s something encouraging: my bank, Shinsei (www.shinseibank.com), requires an account number, card PIN and password for authentication to their on-line banking. They offer the option (in fact, it used to be the only option) of using the &#8220;secure input keypad&#8221; when entering your PIN. This pops up a new window with buttons from zero to nine that you click with the mouse. Even better, the buttons are placed randomly every time.</p>
<p>I was pretty surprised to see this coming from a bank, though they are well known for having very good IT guys.</p>
<p>Posted by: Curt Sampson at April 4, 2005 08:35 PM</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/04/06/neat-idea-to-make-login-more-secure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The logout problem, and back buttoning to Login&#8230;</title>
		<link>http://www.novolocus.com/2005/04/05/the-logout-problem-and-back-buttoning-to-login/</link>
		<comments>http://www.novolocus.com/2005/04/05/the-logout-problem-and-back-buttoning-to-login/#comments</comments>
		<pubDate>Tue, 05 Apr 2005 14:04:22 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=283</guid>
		<description><![CDATA[A guy I work with asked an interesting question today - how do you deal with users hitting the back button in their browser to take them into an application that they&#8217;ve logged out of?
I found an article at JavaWorld that gives an interesting, albeit slight confusing, approach. I made some notes based on that [...]]]></description>
			<content:encoded><![CDATA[<p>A guy I work with asked an interesting question today - how do you deal with users hitting the back button in their browser to take them into an application that they&#8217;ve logged out of?</p>
<p>I found an article at <a href="http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html">JavaWorld</a> that gives an interesting, albeit slight confusing, approach. I made some notes based on that here, and offer some slight improvements.</p>
<p>To state the problem - a user (Alice) logs in to a website, does whatever, and logs out. Another user (Eve) comes along an presses the back button; the web application should not show any of the pages from the Alice&#8217;s session (or indeed, the site) until the next correct login is given.<span id="more-283"></span></p>
<p>There are three aspects to this - preventing cacheing, forcing login, and preventing Login from a stored page.</p>
<p>Preventing caching is straight forward enough - you send the appropriate headers, expiry dates, etc.. That&#8217;s not very interesting - look it up somewhere else&#8230;</p>
<p>Likewise, forcing login isn&#8217;t all that interesting. You&#8217;ll need some sort of session mechanism (most worthwhile language have LOTS of help with this), so for each session, you simply store whether the user is logged in. If not, take them to the login page. Do that for each script that you want restricted. Not very hard. Servlets can have all sorts of security configured in the Web.xml file, so it&#8217;s straight forward enough to protect pages.</p>
<p>But, this is where it gets more interesting - what if Eve presses the back button until she gets to Alice&#8217;s login page?</p>
<p>It&#8217;s worth considering what happens when the back button is pressed. If a page was requested using GET, then it is shown. If a page has Post data, a message is displayed - something like<br />
<code><br />
     Warning: Page has Expired<br />
    The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.</p>
<p>    To resubmit your information and view this Webpage, click the Refresh button.</code><br />
If Eve then hits refresh, she&#8217;ll be logged back in - as <strong>Alice</strong>. This is not desirable.</p>
<p>To prevent this, the login page should contain a hidden field - the System Time of the server when the login page was served (we&#8217;ll call this SysTime). In the database, the User record should have a field of when the user last logged in (we&#8217;ll call this DBTime). For a login to be allowed SysTime must be later than DBTime. If the login is allowed, the DBTime is updated to be SysTime.</p>
<p>Naturally, you also want to do all you usual user authentication - valid username, correct password, etc..</p>
<p>Great! Now, what if someone tries to spoof the SysTime value? What if they create the HTTP request using the user&#8217;s username and password, but another time?</p>
<p>Well, to prevent that, don&#8217;t serve the time, but the time encrypted. Use a block cipher - that is a simple one, with one password to encrypt and decrypt. And also store with the time the session ID. By the time you&#8217;re trying to authenticate, the session should have been initialised. Consequently, the value of the hidden field will be a time, encrypted, that is specific to that session.</p>
<p>When the form is submitted, unencrypt the hidden field. If the session ID stored in it and the ID of, well, the session don&#8217;t match, someone is trying to spoof the session. If they do match, but the SysTime value is older than the DBTime, then this is an old login. Otherwise, it is a true login, and let the user in.</p>
<p>Note:</p>
<p>Spoofing the Login Time - Can&#8217;t be done! It&#8217;s encrypted, and specific to that session.</p>
<p>&#8216;Down Time&#8217; due to client machine being on a different time - Doesn&#8217;t matter! It&#8217;s the SERVER&#8217;s time that matters, the client can be in NeverNeverland time as far as the server is concerned.</p>
<p>&#8216;Down Time&#8217; due to daylight savings time changes - just always use a fixed time reference, such as GMT.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/04/05/the-logout-problem-and-back-buttoning-to-login/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SHA-1 Hash broken&#8230;</title>
		<link>http://www.novolocus.com/2005/02/16/sha-1-hash-broken/</link>
		<comments>http://www.novolocus.com/2005/02/16/sha-1-hash-broken/#comments</comments>
		<pubDate>Wed, 16 Feb 2005 10:02:37 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Languages]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=293</guid>
		<description><![CDATA[Apparently, SHA-1 might have been broken. Well, I say &#8216;broken&#8217;, but it&#8217;s not like it&#8217;s a code to &#8216;break&#8217;. Rather, some guys have been able to figure out a way to make a collision with a hash much easier. No more MD5, no more SHA-1 - what&#8217;s next?
]]></description>
			<content:encoded><![CDATA[<p>Apparently, <a href="http://www.schneier.com/blog/archives/2005/02/sha1_broken.html">SHA-1</a> might have been broken. Well, I say &#8216;broken&#8217;, but it&#8217;s not like it&#8217;s a code to &#8216;break&#8217;. Rather, some guys have been able to figure out a way to make a collision with a hash <em>much</em> easier. No more MD5, no more SHA-1 - what&#8217;s next?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/02/16/sha-1-hash-broken/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Passwords, Secret questions, and expiring Authentication</title>
		<link>http://www.novolocus.com/2005/02/13/passwords-secret-questions-and-expiring-authentication/</link>
		<comments>http://www.novolocus.com/2005/02/13/passwords-secret-questions-and-expiring-authentication/#comments</comments>
		<pubDate>Sun, 13 Feb 2005 08:02:18 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=296</guid>
		<description><![CDATA[An interesting morning, not bad given that it isn&#8217;t 0915 yet. Anyways, I&#8217;ve just read some fascinating articles&#8230;
A guy I work with had been asking about how to figure out the entropy of a password. This is, put simply, measuring the disorder of a password - the more disordered, the harder it is to predict. [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting morning, not bad given that it isn&#8217;t 0915 yet. Anyways, I&#8217;ve just read some fascinating articles&#8230;</p>
<p>A guy I work with had been asking about how to figure out the entropy of a password. This is, put simply, measuring the disorder of a password - the more disordered, the harder it is to predict. And this is very hard to do, for reasons I&#8217;ll explain some other time.</p>
<p>Anyways, we then discussed passphrases. Instead of being a word like &#8216;Bgc4$4q2&#8242; or something equally obscure, you use a phrase that would be difficult to reproduce - &#8216;Eat flying doughnut on Thursday&#8217;. This is still difficult to figure out the entropy for - you could choose an easily predicted password (e.g. &#8216;In the beginning God created the heaven and the earth&#8217;) - but is generally more secure.</p>
<p>So this morning I read a fascinating article by a guy from Microsoft PSS Security <a href="http://weblogs.asp.net/robert_hensing/archive/2004/07/28/199610.aspx">about passphrases</a>. Worth a look for all techies, certainly I&#8217;ll be looking at using passphrases from here on.</p>
<p>I&#8217;ve also just read an article about how <a href="http://www.schneier.com/blog/archives/2005/02/authentication.html">authentication never expires</a> in e-commerce sites. An interesting point - it should be possible to terminate accounts on e-commerce sites. I mean, if you don&#8217;t, if the account is still valid, then your details could be used. But I can&#8217;t say that I know of a way to go to Amazon and tell them to disable my account.</p>
<p>I guess one option would be that if an account just hasn&#8217;t seen any activity in a while, you send out an email warning of it&#8217;s impending shutdown. If there is no response, close it down. Not perfect, but you&#8217;re making the window for the abuse of that username/password smaller.</p>
<p>And lastly, there is an article on <a href="http://www.schneier.com/blog/archives/2005/02/the_curse_of_th.html">why secret questions are a bad idea</a> for password recovery. Basically, it&#8217;s the old &#8216;Security is as good as it&#8217;s weakest link&#8217;. Never liked these things anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/02/13/passwords-secret-questions-and-expiring-authentication/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on Realm Authentication with Tomcat</title>
		<link>http://www.novolocus.com/2005/01/26/more-on-realm-authentication-with-tomcat/</link>
		<comments>http://www.novolocus.com/2005/01/26/more-on-realm-authentication-with-tomcat/#comments</comments>
		<pubDate>Wed, 26 Jan 2005 22:01:55 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Database]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Web Servers]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=298</guid>
		<description><![CDATA[Okay, so I had a play with Realm Authentication&#8230;

First things was where the &#60;Realm&#62; tag should go. Umm, I&#8217;m a little unfamiliar with Tomcat. Tracked it down eventually - lots of examples of realm tags in server.xml. Not the right place still - I just want this to apply to my single web application - [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so I had a play with Realm Authentication&#8230;<br />
<span id="more-298"></span><br />
First things was where the &lt;Realm&gt; tag should go. Umm, I&#8217;m a little unfamiliar with Tomcat. Tracked it down eventually - lots of examples of realm tags in server.xml. Not the right place still - I just want this to apply to my single web application - but good enough for now.</p>
<p>The realm tag I used was:<br />
<code>&lt;Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"<br />
driverName="com.mysql.jdbc.Driver"<br />
connectionURL="jdbc:mysql://localhost/jtest"<br />
connectionName="root" connectionPassword="password"<br />
userTable="tusers" userNameCol="cUser" userCredCol="cPwd" userRoleTable="troles" roleNameCol="cRole"/&gt;</code><br />
Naturally, this requires the MySQL JDBC driver from Mysql.com. Download it, and place it into the $Tomcat\common\lib directory (still with me?) <img src="http://www.novolocus.com/wp-content/oldEmoticons/wink.gif" align="middle" border="0" /></p>
<p>Careful that you actually enter the correct password - some idiots try to configure the JDBC connection with the wrong password <img src="http://www.novolocus.com/wp-content/oldEmoticons/dry.gif" align="middle" border="0" /></p>
<p>Next up, set up some tables in MySQL:<br />
<code><br />
Table tusers:<br />
+-------+-------------+------+-----+---------+-------+<br />
| Field | Type        | Null | Key | Default | Extra |<br />
+-------+-------------+------+-----+---------+-------+<br />
| cUser | varchar(32) |      | PRI |         |       |<br />
| cPwd  | varchar(32) |      |     |         |       |<br />
+-------+-------------+------+-----+---------+-------+</p>
<p>Table troles:<br />
+-------+-------------+------+-----+---------+-------+<br />
| Field | Type        | Null | Key | Default | Extra |<br />
+-------+-------------+------+-----+---------+-------+<br />
| cUser | varchar(32) |      | MUL |         |       |<br />
| cRole | varchar(32) |      |     |         |       |<br />
+-------+-------------+------+-----+---------+-------+</code><br />
And populate with data:<br />
<code>+-------+-------+<br />
| cUser | cPwd  |<br />
+-------+-------+<br />
| Alice | bingo |<br />
| Bob   | chuck |<br />
| Eve   | daily |<br />
+-------+-------+</p>
<p>+-------+-------+<br />
| cUser | cRole |<br />
+-------+-------+<br />
| Alice | user  |<br />
| Alice | admin |<br />
| Bob   | user  |<br />
+-------+-------+</code><br />
So, we&#8217;ve got our user and role tables set up, Tomcat configured to query it - only 2 more essential components to configure. What, you ask, with baited breath. (Actually, would baited breath not smell? I digress&#8230;)</p>
<p>We need content to apply our permissions to, and a web deployment descriptor (web.xml) to describe the security applied to these resources.</p>
<p>I created 2 html files. That&#8217;s right, just HTML, not servlets, not JSP, just static html. I created user.html and admin.html :<br />
<code>&lt;html&gt;<br />
&lt;head&gt;&lt;title&gt;UserAuth&lt;/title&gt;&lt;/head&gt;<br />
&lt;body&gt;User Perm Authenticated&lt;/body&gt;<br />
&lt;/html&gt;</code><br />
Admin.html is the same, just with &#8216;admin&#8217; where it says &#8216;user&#8217;.</p>
<p>In my $Tomcat\webapps directory, I created a new directory &#8216;test&#8217;. Beneath this, I created a directory &#8216;html&#8217; and I put the html files in there. It just seemed like a good idea, though I guess you could stick it under the root - just you&#8217;ve have to specify a different &lt;security-constraint&gt;. See below, you&#8217;ll get what I mean.</p>
<p>I also created a WEB-INF directory for the web.xml file. I then wrote my web.xml file:<br />
<code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;<br />
&lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"<br />
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"<br />
    version="2.4"&gt;</p>
<p>    &lt;description&gt;<br />
      JSP 2.0 Examples.<br />
    &lt;/description&gt;<br />
    &lt;display-name&gt;JSP 2.0 Examples&lt;/display-name&gt;<br />
	&lt;security-constraint&gt;<br />
		&lt;web-resource-collection&gt;<br />
	           &lt;web-resource-name&gt;userstuff&lt;/web-resource-name&gt;<br />
				&lt;url-pattern&gt;/html/user.html&lt;/url-pattern&gt;<br />
		&lt;/web-resource-collection&gt;<br />
		&lt;auth-constraint&gt;<br />
			&lt;role-name&gt;user&lt;/role-name&gt;<br />
		&lt;/auth-constraint&gt;<br />
	&lt;/security-constraint&gt;</p>
<p>	&lt;security-constraint&gt;<br />
		&lt;web-resource-collection&gt;<br />
			&lt;web-resource-name&gt;adminstuff&lt;/web-resource-name&gt;<br />
				&lt;url-pattern&gt;/html/admin.html&lt;/url-pattern&gt;<br />
		&lt;/web-resource-collection&gt;<br />
		&lt;auth-constraint&gt;<br />
			&lt;role-name&gt;admin&lt;/role-name&gt;<br />
		&lt;/auth-constraint&gt;<br />
	&lt;/security-constraint&gt;</p>
<p>	&lt;login-config&gt;<br />
		&lt;auth-method&gt;BASIC&lt;/auth-method&gt;<br />
		&lt;realm-name&gt;test&lt;/realm-name&gt;<br />
	&lt;/login-config&gt;</p>
<p>	&lt;security-role&gt;<br />
		&lt;role-name&gt;user&lt;/role-name&gt;<br />
		&lt;role-name&gt;admin&lt;/role-name&gt;<br />
	&lt;/security-role&gt;</p>
<p>&lt;/web-app&gt;</code><br />
Things to notice - I have seperate &lt;security-constraints&gt; for the two html files, though as it is a pattern match on the path, you don&#8217;t have to. And I have two roles, user and admin.</p>
<p>That&#8217;s it, really. Try going to the path for each of the files and logging in as Alice, Bob and Eve. &#8216;Nuff said.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/01/26/more-on-realm-authentication-with-tomcat/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Clever Cats</title>
		<link>http://www.novolocus.com/2005/01/26/clever-cats/</link>
		<comments>http://www.novolocus.com/2005/01/26/clever-cats/#comments</comments>
		<pubDate>Wed, 26 Jan 2005 11:01:22 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[Security]]></category>

		<category><![CDATA[Web Servers]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=299</guid>
		<description><![CDATA[Okay, so Tomcat 5 has some neat tricks I didn&#8217;t know about! Using the Web.xml file, you can declare a database to check for username/password/role, and provide access to resources as defined elsewhere in the web.xml file.
Only of interest to geeks, but quite clever really. You can even specify the MessageDigest algorithm used to hash [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so <a href="http://www.bbspot.com/News/BBloopers/2005/01/1244.php">Tomcat 5</a> has some neat tricks I didn&#8217;t know about! Using the Web.xml file, you can declare a database to check for username/password/role, and provide access to resources as defined elsewhere in the web.xml file.</p>
<p>Only of interest to geeks, but quite clever really. You can even specify the MessageDigest algorithm used to hash a password. Will have a play and see how well it works&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2005/01/26/clever-cats/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
