<?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; 2006 &#187; December</title>
	<atom:link href="http://www.novolocus.com/2006/12/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>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>Random but cool</title>
		<link>http://www.novolocus.com/2006/12/27/random-but-cool/</link>
		<comments>http://www.novolocus.com/2006/12/27/random-but-cool/#comments</comments>
		<pubDate>Wed, 27 Dec 2006 10:12:06 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[A Bit Random]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=112</guid>
		<description><![CDATA[The Office Supplies Trebuchet
]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.instructables.com/id/E9N3IONHLIEP287NKS/">Office Supplies Trebuchet</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/27/random-but-cool/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>Remove the annoying Event Toaster</title>
		<link>http://www.novolocus.com/2006/12/15/remove-the-annoying-event-toaster/</link>
		<comments>http://www.novolocus.com/2006/12/15/remove-the-annoying-event-toaster/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 12:12:06 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=115</guid>
		<description><![CDATA[Remove it like this. Annoying Effing thing, I&#8217;ve no idea why they put this into Visual Studio
]]></description>
			<content:encoded><![CDATA[<p><a href="http://cristipotlog.blogspot.com/2006/10/disabling-event-toaster-tray-icon.html">Remove it like this.</a> Annoying Effing thing, I&#8217;ve no idea why they put this into Visual Studio</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/15/remove-the-annoying-event-toaster/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The speed of collections and For loops in C#</title>
		<link>http://www.novolocus.com/2006/12/04/the-speed-of-collections-and-for-loops-in-c/</link>
		<comments>http://www.novolocus.com/2006/12/04/the-speed-of-collections-and-for-loops-in-c/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 14:12:06 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=116</guid>
		<description><![CDATA[Some of the .NET training I&#8217;m doing started me wondering about speeds and things. So, I wrote some testing and turned up some interesting things&#8230;
First off, I tried comparing the speed of populating and reading from generic and normal collections. I found that Generics are much faster to populate as well as read from. I&#8217;d [...]]]></description>
			<content:encoded><![CDATA[<p>Some of the .NET training I&#8217;m doing started me wondering about speeds and things. So, I wrote some testing and turned up some interesting things&#8230;</p>
<p>First off, I tried comparing the speed of populating and reading from generic and normal collections. I found that Generics are much faster to populate as well as read from. I&#8217;d expected the latter (no type conversion needed), but not a better speed at population. I guess this is because the types can be checked at compile time. I tried this with both a value type (so there might be boxing/unboxing), and a reference type - each time the result was the same, non-generics took ten times as long as generics.</p>
<p>Populating a generic list is twice as fast if it has its capacity assigned. E.g.</p>
<p><code>List&lt;SomeObj&gt; myList = new List&lt;SomeObj&gt; ( 10000 );</code></p>
<p>Populating a non-generic list is actually <strong>slower</strong> if it has its capacity assigned. I have absolutely no idea why.</p>
<p><em>FOR</em> Loops are slightly faster than <em>FOREACH</em> loops. However, the difference is piddling, so I&#8217;d actually recommend not worrying. Out of preference, I&#8217;ll use <em>FOREACH</em>, &#8216;cos it&#8217;s easier to read.</p>
<p>Looking at converting types (well, an integer in most of my tests) I found that:</p>
<ul>
<li><em>AS</em> is slightly faster than a cast</li>
<li>(cast) is <strong>much</strong> faster than <em>System.Convert</em></li>
</ul>
<p>It&#8217;s worth noting that if a conversion fails, <em>AS</em> will just return <em>NULL</em>, whereas a cast returns an exception. Raising an exception is slower than testing for null. Therefore, AS has a definite speed advantage, and hence why you shouldn&#8217;t handle expected exceptions using, um, exceptions. Instead, test something and then deal with the exception case. For example, you something like <em>TryParse</em>. (Actually, I should give that a whirl, see how long it takes.)E.g.</p>
<p><code>int w = 12;<br />
Object o = w;</code></p>
<p>//fastest conversion and error handling<br />
int x = o as int;<br />
if( x == null) { };</p>
<p>//Okay speed, very slow error handling<br />
try {<br />
int y = (int) o;<br />
} catch ( InvalidCastExpection e ) {}</p>
<p>//Don&#8217;t do this<br />
try {<br />
int y = System.Convert.ToInt32(o);<br />
} catch ( InvalidCastExpection e ) {}</p>
<p>I&#8217;ll get back to you all about the <em>TryParse</em> thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/04/the-speed-of-collections-and-for-loops-in-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Developer Day 4</title>
		<link>http://www.novolocus.com/2006/12/04/developer-day-4/</link>
		<comments>http://www.novolocus.com/2006/12/04/developer-day-4/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 13:12:58 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=117</guid>
		<description><![CDATA[So, I went to Developer Day 4, and it was very good. I&#8217;m now looking forward to WebDD. So, what of the talks at this one&#8230;
I went to Ben Lamb&#8217;s &#8220;How to write crap code in C#&#8221;. It was pretty simple, but showed just what you can do to compromise performance. Actually, the biggest message [...]]]></description>
			<content:encoded><![CDATA[<p>So, I went to <a href="http://www.developerday.co.uk/ddd/default.asp">Developer Day 4</a>, and it was very good. I&#8217;m now looking forward to <a href="http://www.webdd.org.uk/Default.aspx">WebDD</a>. So, what of the talks at this one&#8230;</p>
<p>I went to <a href="http://www.novolocus.com/wp-admin/www.benlamb.com">Ben Lamb&#8217;s</a> &#8220;How to write crap code in C#&#8221;. It was pretty simple, but showed just what you can do to compromise performance. Actually, the biggest message I got from it was that it&#8217;s worth testing some of the standard &#8216;performance tips&#8217; - which was funny as I did that just last week.</p>
<p>The other notable talk was &#8220;Securing ASP .NET Websites&#8221; by <a href="http://idunno.org/default.aspx%22">Barry Doran</a>. Apart from it being nice to listen to someone with a proper accent, it was a good high level view of the decisions that you have to make when building a website like that. Some of it was new, some of it was old hat, and it was nice to see the reasoning too. He&#8217;s a characterful speaker too.</p>
<p>Also, the talk &#8220;Securing Web Services using WS-*&#8221; by Chris Seary was a good &#8216;un - finally, I have an answer to the question &#8220;Why Bother? Why not SSL or IPSec&#8221;. Nice to have a bit of a higher level view explained</p>
<p>In addition, I went to one about &#8220;Using and Abusing Reflection&#8221; - which seemed a bit too specialised to be of use generally - and making fun of the Irish isn&#8217;t a great laugh. Our HR manager would have me warned if I ever did something like that - and quite right too.</p>
<p>Finally, there was the &#8220;Technet Highlights&#8221; talk, which was great fun, but pretty content free. It did say it wouldn&#8217;t be techy. I guess I&#8217;d just wanted to hear more of what the buzz was in Barcelona, what things are hot and what&#8217;s not (and what the stylish developer will be coding in this season). Still, they were generous with the swag - I&#8217;m not sure who they mugged to get all that.</p>
<p>The conclusion - I&#8217;ll be going to the next one (unless I&#8217;m promoted into management and never touch code again (Not likely))</p>
<p class="oldCommentOuter">Comments from my old blog:</p>
<p class="oldCommentInner">
<p class="oldComment">Thanks for swelling my ego; I&#8217;m glad you enjoyed it and found it useful.</p>
<p class="oldCommentFooter">By Barry Dorrans at 21:09:42 Monday 4th December 2006</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/04/developer-day-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CLR Runtime Profilers</title>
		<link>http://www.novolocus.com/2006/12/03/clr-runtime-profilers/</link>
		<comments>http://www.novolocus.com/2006/12/03/clr-runtime-profilers/#comments</comments>
		<pubDate>Sun, 03 Dec 2006 08:12:03 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=118</guid>
		<description><![CDATA[List of them here. And the normal Microsoft one.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.msdn.com/brada/archive/2005/03/17/398060.aspx">List of them here</a>. And the <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=A362781C-3870-43BE-8926-862B40AA0CD0&amp;displayLang=en">normal Microsoft one</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/12/03/clr-runtime-profilers/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
