<?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>Andreas Louca</title>
	<atom:link href="http://andreas.louca.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://andreas.louca.org</link>
	<description>programmer, student, boyfriend, dreamer, in love, photographer</description>
	<pubDate>Fri, 06 Jun 2008 11:39:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Back from Mulhouse</title>
		<link>http://andreas.louca.org/2008/06/06/back-from-mulhouse/</link>
		<comments>http://andreas.louca.org/2008/06/06/back-from-mulhouse/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 11:39:56 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[university]]></category>

		<category><![CDATA[ANA Project]]></category>

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

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=51</guid>
		<description><![CDATA[I had the chance to be attending an ANA meeting, at Mulhouse, France. Apart from having difficulties with the language, I had the chance not only to meet some very interesting people, but have a glimpse at Central European culture.
While it was not the first time I visited Central European countries and cities, I never [...]]]></description>
			<content:encoded><![CDATA[<p>I had the chance to be attending an <a href="http://www.ana-project.org/">ANA</a> meeting, at <a href="http://maps.google.co.uk/maps?f=q&#038;hl=en&#038;geocode=&#038;q=Mulhouse,+France&#038;ie=UTF8&#038;z=12&#038;iwloc=addr">Mulhouse, France</a>. Apart from having difficulties with the language, I had the chance not only to meet some very interesting people, but have a glimpse at Central European culture.</p>
<p>While it was not the first time I visited Central European countries and cities, I never had the chance to see deeper than the tourist wrap. I guess I was either too young, or there with the wrong purpose. I was also lucky to have some amazing people with me, and that&#8217;s what made the difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/06/06/back-from-mulhouse/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GSoC Kick-start</title>
		<link>http://andreas.louca.org/2008/05/26/gsoc-kick-start/</link>
		<comments>http://andreas.louca.org/2008/05/26/gsoc-kick-start/#comments</comments>
		<pubDate>Mon, 26 May 2008 09:08:49 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[work]]></category>

		<category><![CDATA[CSS Edit]]></category>

		<category><![CDATA[Google Summer of Code]]></category>

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

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=50</guid>
		<description><![CDATA[This summer, as part of the Google Summer of Code, I will be working on a CSS Addin for MonoDevelop. This will include adding support for syntax highlighting, code completition, support for CSS schemas and creating a UI to assist in development. My plan is to
complete the infrastructure first (css parser, schema builder and so [...]]]></description>
			<content:encoded><![CDATA[<p>This summer, as part of the <a href="http://code.google.com/soc/2008/">Google Summer of Code</a>, I will be working on a CSS Addin for <a href="http://monodevelop.org/Main_Page">MonoDevelop</a>. This will include adding support for syntax highlighting, code completition, support for CSS schemas and creating a UI to assist in development. My plan is to<br />
complete the infrastructure first (css parser, schema builder and so on) and then move on to implement the UI.</p>
<p>In order to make the whole process more interested and transparent, I&#8217;ll post a post every week detailing what I&#8217;m planning to do, and what I have completed. This will also be sent to a Mono mailing list for the Summer of Code.</p>
<p>Achievements:<br />
N/A (yet:-)</p>
<p><strong>Objectives</strong>:</p>
<ul>
<li>Create a wiki page (or a google docs document) and prepare a timeline for the project</li>
<li>Bootstrap a MonoDevelop Addin</li>
<li>Implement the CSS Parser</li>
<li>Add syntax highlighting</li>
<li>Start investigating possible UI solutions by reviewing existing implementations. Note possible features on the wiki.</li>
<p>That&#8217;s it for a start!</p>
<p>Good luck to me and you with your projects!</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/05/26/gsoc-kick-start/feed/</wfw:commentRss>
		</item>
		<item>
		<title>All done, more coming</title>
		<link>http://andreas.louca.org/2008/05/10/all-done-more-coming/</link>
		<comments>http://andreas.louca.org/2008/05/10/all-done-more-coming/#comments</comments>
		<pubDate>Sat, 10 May 2008 13:18:06 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[work]]></category>

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

		<category><![CDATA[Functional Composition]]></category>

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

		<category><![CDATA[Summer of Code]]></category>

		<category><![CDATA[ThinkPad X300]]></category>

		<guid isPermaLink="false">http://andreas.louca.org/?p=49</guid>
		<description><![CDATA[Well, I&#8217;ve finished the exams! Overall I did pretty well, however the final results will need to confirm that. The boring part is over, now it is time for some real work! 
I will continue working for the ANA Project, on the Functional Composition Framework, porting a classifier to the framework and evaluating the results. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;ve finished the exams! Overall I did pretty well, however the final results will need to confirm that. The boring part is over, now it is time for some real work! </p>
<p>I will continue working for the <a href="http://www.ana-project.org/">ANA Project</a>, on the Functional Composition Framework, porting a classifier to the framework and evaluating the results. </p>
<p>Of course, I will start working on my <a href="http://code.google.com/soc/2008/">Google&#8217;s Summer of Code</a> project as well, to create a CSS Editor plugin for <a href="http://www.monodevelop.com/Main_Page">MonoDevelop</a>. More of details regarding the project will follow, as soon as I get started :-).</p>
<p>Aw, and I got a brand new <a href="http://www.notebookreview.com/default.asp?newsID=4270">Lenovo Thinkpad X300</a>. First impressions: ultra light, solid, very fast and Linux powered!. I&#8217;ll dedicate a post for this, because I got a lot to write about.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/05/10/all-done-more-coming/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Exam period</title>
		<link>http://andreas.louca.org/2008/05/01/exam-period/</link>
		<comments>http://andreas.louca.org/2008/05/01/exam-period/#comments</comments>
		<pubDate>Thu, 01 May 2008 19:53:52 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[university]]></category>

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=48</guid>
		<description><![CDATA[Perhaps one of the most difficult time of the year, for students at least, is the final exams. Full of studying, stress and anxiety. Fortunately my girlfriend was around for a few days, and things had a bright sight as well.
So, until 9th of May, not much will be going around here!
My exam schedule is:

Monday [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps one of the most difficult time of the year, for students at least, is the final exams. Full of studying, stress and anxiety. Fortunately my girlfriend was around for a few days, and things had a bright sight as well.</p>
<p>So, until 9th of May, not much will be going around here!</p>
<p>My exam schedule is:</p>
<ul>
<li><del datetime="2008-05-01T19:23:02+00:00">Monday - 28/4 - C.SC 251 - Networking</del> - <em>Done!</em></li>
<li><del datetime="2008-05-02T16:22:47+00:00">Friday - 2/5 - C.SC 252 - Human Computer Interaction</del> - <em>Done!</em></li>
<li><del datetime="2008-05-05T17:35:17+00:00">Monday - 5/5 - C.SC 253 - Distributed Systems</del> - <em>Done!</em></li>
<li><del datetime="2008-05-07T18:46:10+00:00">Wednesday - 7/5 C.SC 353 - Advanced Networking</del> - <em>Done!</em></li>
<li><del datetime="2008-05-10T12:32:51+00:00">Friday - 9/5 C.SC 254 - Languages &#038; Compilation</del> - <em>Done!</em></li>
</ul>
<p>Good luck to me, and see you after the 9th!</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/05/01/exam-period/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Learning to code</title>
		<link>http://andreas.louca.org/2008/04/25/learning-to-code/</link>
		<comments>http://andreas.louca.org/2008/04/25/learning-to-code/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 22:58:31 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[life]]></category>

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=47</guid>
		<description><![CDATA[Yesterday I found a piece of code that I wrote when I was 14. It was a simple IRC service daemon, PHP Oper Services. It had the ability to link with Undernet IRC Daemon in order to provide an operator service. In order to do that it required a parser, in order to understand what [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I found a piece of code that I wrote when I was 14. It was a simple IRC service daemon, <a href="http://sourceforge.net/projects/phposerv/">PHP Oper Services</a>. It had the ability to link with Undernet IRC Daemon in order to provide an operator service. In order to do that it required a parser, in order to understand what the ircd said, as well as a backend database for its users.</p>
<p>When I was younger, I liked playing with something, acquiring its &#8220;juice&#8221;, and then move to something else. While some criticized this approach to learn, stating that I will never learn anything this way and that I was behaving &#8220;immaturely&#8221;, since I was continuously changing subjects. </p>
<p>This service was one of those pet projects, I&#8217;ve developed a hand-written parser that was able to link successfully with the IRCD, obeying the server-to-server grammar.  Since I never read any books explaining what a parser is, I just read code examples, I had to discover myself the &#8220;secrets&#8221; of parsing.</p>
<p>This semester I took the &#8220;Languages &#038; Compilation&#8221; course, which of course started with what a grammar is, and moved up to a lexical analyzer, parser and finally compilation. Reading the theory and seeing the example code I had the feeling that I&#8217;ve seen these stuff before. And indeed I had. That first hand-written parser I wrote back then, gave me with the practical knowledge and experience I needed to have now a more solid understanding of how stuff works [TM].</p>
<p>This is just an example of the little pet projects I had. I have a bunch of them. Little small unfinished projects, focusing on different aspects of computer science. All that programming I&#8217;ve done, all those projects gave me the foundations to evolve my coding style and extend my knowledge, even a little. Now that I have real tasks to accomplish, I have that experience to start with.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/04/25/learning-to-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accepted in Google&#8217;s Summer of Code!</title>
		<link>http://andreas.louca.org/2008/04/22/accepted-in-googles-summer-of-code/</link>
		<comments>http://andreas.louca.org/2008/04/22/accepted-in-googles-summer-of-code/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 12:40:15 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[work]]></category>

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

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

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

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

		<category><![CDATA[Mono Project]]></category>

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

		<category><![CDATA[Summer of Code]]></category>

		<guid isPermaLink="false">http://andreas.louca.org/?p=45</guid>
		<description><![CDATA[I&#8217;ve applied to Google&#8217;s Summer of Code this year for 3 organizations, and I was accepted on the Mono Project. The project is to develop a CSS editor for the MonoDevelop.
Summer of Code runs for 3 months, and the purpose is to develop an open-source program, after it got passed through a selection process. The [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve applied to <a href="http://code.google.com/soc/2008/">Google&#8217;s Summer of Code</a> this year for 3 organizations, and I was accepted on the <a href="http://code.google.com/soc/2008/mono/about.html">Mono Project</a>. The project is to develop a CSS editor for the <a href="http://www.monodevelop.com/Main_Page">MonoDevelop</a>.</p>
<p>Summer of Code runs for 3 months, and the purpose is to develop an open-source program, after it got passed through a selection process. The best thing is that Google pays you for that :-).</p>
<p>It is going to be a very exciting summer (with lots of work :-).</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/04/22/accepted-in-googles-summer-of-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Edit in TextMate (Mac OS X)</title>
		<link>http://andreas.louca.org/2008/04/09/edit-in-textmate-mac-os-x/</link>
		<comments>http://andreas.louca.org/2008/04/09/edit-in-textmate-mac-os-x/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 00:08:03 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[work]]></category>

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

		<category><![CDATA[Mac OS X]]></category>

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

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=41</guid>
		<description><![CDATA[TextMate editor is the right-hand for every Mac OS X programmer, designer and power user. Most of the times we require to put the whole folder into a TextMate project for easier editing, or open a log file for a quick look. In order to do this we have to open TextMate and then drag [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://macromates.com/">TextMate</a> editor is the right-hand for every Mac OS X programmer, designer and power user. Most of the times we require to put the whole folder into a TextMate project for easier editing, or open a log file for a quick look. In order to do this we have to open TextMate and then drag the folder into it, or drag the file, since most of the times weird files are not associated with TextMate (most of the times you don&#8217;t want them associated either).</p>
<p>In order to avoid this, and have a speedier way to launch TextMate with the file, I&#8217;ve written a simple AppleScript to do the above for me. I&#8217;ve packed it into an Application and dragged it into Finder&#8217;s menu-bar, so it can be available on all windows.</p>
<p>You can download the application here: <a href='http://andreas.louca.org/wp-content/2008/04/editintextmateapp.zip'>EditInTextMate.app.zip</a>.</p>
<p>Save the file anywhere you want (I&#8217;ve saved it into /Application/AppleScript), and then drag it on the Finder&#8217;s bar. Mine looks like this:</p>
<p><img src="http://andreas.louca.org/wp-content/2008/04/finderscreenshot.jpg" width="600px" alt="" title="finderscreenshot" /></p>
<p>Based on: http://snippets.dzone.com/posts/show/1037</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/04/09/edit-in-textmate-mac-os-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Photos!</title>
		<link>http://andreas.louca.org/2008/04/07/photos/</link>
		<comments>http://andreas.louca.org/2008/04/07/photos/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 23:49:44 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[life]]></category>

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

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=38</guid>
		<description><![CDATA[I&#8217;ve started taking photos using my first digital camera. It was a Canon PowerShot 620A, I think, and I quickly fell in love with it. Since then I&#8217;ve upgraded to my loyal Canon EOS 400D. Unfortunately lately time isn&#8217;t enough for anything, and I&#8217;ve neglected it, tho I&#8217;m trying to change that.
So in order to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started taking photos using my first digital camera. It was a Canon PowerShot 620A, I think, and I quickly fell in love with it. Since then I&#8217;ve upgraded to my loyal Canon EOS 400D. Unfortunately lately time isn&#8217;t enough for anything, and I&#8217;ve neglected it, tho I&#8217;m trying to change that.</p>
<p>So in order to give myself some motivation, I&#8217;ve included the photos section on the blog, so I&#8217;d be embarrassed not to post new photos. While I&#8217;m still thinking over which photos I should include in this online album, for the moment I&#8217;ve selected a few I like.</p>
<p>The pictures are uploaded into <a href="http://flickr.com/photos/netguy/">my flickr account</a>, and then I use <a href="http://www.randombyte.net/blog/projects/falbum/">FAlbum</a> WordPress plugin to retrieve those photos from flickr, and display them inside my blog.</p>
<p>I&#8217;ve done the initial integration, but I still need to fine tweak the CSS file of the FAlbum, so it can be more well integrated with the rest of the site, but hey, its a start (yes, I&#8217;m lazy :-). Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/04/07/photos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My first Publication!</title>
		<link>http://andreas.louca.org/2008/03/25/my-first-publication/</link>
		<comments>http://andreas.louca.org/2008/03/25/my-first-publication/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 06:36:36 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[university]]></category>

		<guid isPermaLink="false">http://andreas.louca.org/?p=35</guid>
		<description><![CDATA[As part of my degree scheme (Computer Science Innovation @ Lancaster University), I had to work on a research project.
The subject was Functional Composition (I&#8217;ll blog later to elaborate), as part of the Autonomic Network Architecture project, which resulted a paper titled &#8220;A Functional Composition Framework for Autonomic Network Architectures&#8221; at the IEEE ACNM 2008: [...]]]></description>
			<content:encoded><![CDATA[<p>As part of my degree scheme (<a href="http://www.comp.lancs.ac.uk/undergraduates/courses_in_detail_part2.html">Computer Science Innovation</a> @ <a href="http://www.lancaster.ac.uk">Lancaster University</a>), I had to work on a research project.</p>
<p>The subject was Functional Composition (I&#8217;ll blog later to elaborate), as part of the <a href="http://www.ana-project.org/">Autonomic Network Architecture</a> project, which resulted a paper titled &#8220;A Functional Composition Framework for Autonomic Network Architectures&#8221; at the <a href="http://www.netlab.nec.de/acnm08/">IEEE ACNM 2008</a>: workshop on autonomic communications and network management.</p>
<p>I can not thank enough the people who have worked with me, for their time, patience and the<br />
opportunities that they gave me with this project. It was a very interesting, productive and pleasant experience, which I hope we can continue and extend next year.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/03/25/my-first-publication/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java RSA Encryption: An example</title>
		<link>http://andreas.louca.org/2008/03/20/java-rsa-encryption-an-example/</link>
		<comments>http://andreas.louca.org/2008/03/20/java-rsa-encryption-an-example/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 02:13:12 +0000</pubDate>
		<dc:creator>Andreas Louca</dc:creator>
		
		<category><![CDATA[work]]></category>

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

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

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

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

		<category><![CDATA[how-to]]></category>

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

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

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

		<guid isPermaLink="false">http://andreas.louca.org/?p=34</guid>
		<description><![CDATA[I had to use asymmetric keys in order to finish a university assignment, and to my amazement Sun could not publish any examples of using RSA keys in Java, because they were restricted by one of the stupidest laws in existence: US Cryptographic Export Laws. After playing with the API for a little while, I’ve managed to figure it out, eventually.]]></description>
			<content:encoded><![CDATA[<p>I had to use asymmetric keys in order to finish a university assignment, and to my amazement Sun could not publish any examples of using RSA keys in Java, because they were restricted by one of the stupidest laws in existence: US Cryptographic Export Laws. After playing with the API for a little while, I&#8217;ve managed to figure it out, eventually. </p>
<p>So I&#8217;m writing this post for those who want a simple example on how the key generation and encryption process works using RSA asymmetric keys.</p>
<p>Just for introduction, RSA is an algorithm for public-key cryptography. It was the first algorithm known to be suitable for signing as well as encryption, and one of the first great advances in public key cryptography. RSA is widely used in electronic commerce protocols, and is believed to be secure given sufficiently long keys and the use of up-to-date implementations. For more information on how RSA works, please take a look at the relevant <a href="http://en.wikipedia.org/wiki/RSA">Wikipedia article</a>.</p>
<p>In order to start using RSA cryptography in Java, you will need to generate a key-pair: a public and a private key. The public key will be used to encrypt the data, and the private key will be used to decrypt the data. Without the private key, the data can not be decrypted, therefore it is suitable in cases where the clients want to send the server a shared-secret key or authentication information, in order to use for a session (kinda like SSL/TLS does). Java, starting version 1.5.0, provides a tool in the API for generating RSA key pairs.</p>
<p>The following code demonstrates how to use <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/security/KeyPairGenerator.html">KeyPairGenerator</a> to generate an RSA key-pair in Java:</p>
<blockquote><p>
// Get an instance of the RSA key generator<br />
KeyPairGenerator kpg = KeyPairGenerator.getInstance(&#8221;RSA&#8221;);<br />
// Generate the keys &#8212; might take sometime on slow computers<br />
KeyPair myPair = kpg.generateKeyPair();</p></blockquote>
<p>This will give you a <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/security/KeyPair.html">KeyPair</a> object, which holds two keys: a private and a public. In order to make use of these keys, you will need to create a <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/crypto/Cipher.html">Cipher</a> object, which will be used in combination with <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/crypto/SealedObject.html">SealedObject</a> to encrypt the data that you are going to end over the network. Here&#8217;s how you do that:</p>
<blockquote><p>
// Get an instance of the Cipher for RSA encryption/decryption<br />
Cipher c = Cipher.getInstance(&#8221;RSA&#8221;);<br />
// Initiate the Cipher, telling it that it is going to Encrypt, giving it the public key<br />
c.init(Cipher.ENCRYPT_MODE, myPair.getPublic());
</p></blockquote>
<p>After initializing the Cipher, we&#8217;re ready to encrypt the data. Since after encryption the resulting data will not make much sense if you see them &#8220;naked&#8221;, we have to encapsulate them in another Object. Java provides this, by the SealedObject class. SealedObjects are containers for encrypted objects, which encrypt and decrypt their contents with the help of a Cipher object. </p>
<p>The following example shows how to create and encrypt the contents of a SealedObject:</p>
<blockquote><p>
// Create a secret message<br />
String myMessage = new String(&#8221;Secret Message&#8221;);<br />
// Encrypt that message using a new SealedObject and the Cipher we created before<br />
SealedObject myEncyptedMessage = new SealedObject( myMessage, c);</p></blockquote>
<p>The resulting object can be sent over the network without fear, since it is encrypted. The only one who can decrypt and get the data, is the one who holds the private key. Normally, this should be the server. In order to decrypt the message, we&#8217;ll need to re-initialize the Cipher object, but this time with a different mode, decrypt, and use the private key instead of the public key.</p>
<p>This is how you do this in Java:</p>
<blockquote><p>// Get an instance of the Cipher for RSA encryption/decryption<br />
Cipher dec = Cipher.getInstance(&#8221;RSA&#8221;);<br />
// Initiate the Cipher, telling it that it is going to Decrypt, giving it the private key<br />
dec.init(Cipher.DECRYPT_MODE, myPair.getPrivate());</p></blockquote>
<p>Now that the Cipher is ready to decrypt, we must tell the SealedObject to decrypt the held data. </p>
<blockquote><p>
// Tell the SealedObject we created before to decrypt the data and return it<br />
String message = (String)test.getObject(myEncyptedMessage);<br />
System.out.println(&#8221;foo = &#8220;+message);</p></blockquote>
<p>Beware when using the <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/crypto/SealedObject.html#getObject(javax.crypto.Cipher)">getObject</a> method, since it returns an instance of an Object (even if it is actually an instance of String), and not an instance of the Class that it was before encryption, so you&#8217;ll have to cast it to its prior form.</p>
<p>This is a small introductory example on how to generate RSA keys in Java and use them to encrypt objects. I&#8217;ll follow up with a tutorial on how to use asymmetric and symmetric keys in order to have secure network communication in Java.</p>
]]></content:encoded>
			<wfw:commentRss>http://andreas.louca.org/2008/03/20/java-rsa-encryption-an-example/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
