<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating Public and Private Certificates/Keys</title>
	<atom:link href="http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/</link>
	<description>one of those blogs</description>
	<lastBuildDate>Sat, 04 Feb 2012 22:43:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: madhu</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2917</link>
		<dc:creator>madhu</dc:creator>
		<pubDate>Mon, 12 Jan 2009 06:55:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2917</guid>
		<description>Great work ..! thanks a lot.</description>
		<content:encoded><![CDATA[<p>Great work ..! thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toly</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2916</link>
		<dc:creator>Toly</dc:creator>
		<pubDate>Sun, 14 Sep 2008 04:14:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2916</guid>
		<description>Hi Walter,
&lt;p&gt;
   You can encrypt many more than 200 characters :)
   But here is a quick (and dirty) example on how to do it:
&lt;/p&gt;
&lt;p&gt;
   Let&#039;s assume that you have generated a public key (or somebody gave you one) as a file &quot;public.cer&quot;, then you can do this:
&lt;/p&gt;
&lt;pre class=&quot;java&quot;&gt;

File keyFile = new File(&quot;public.cer&quot;);
byte[] encodedKey = new byte[(int)keyFile.length()];

new FileInputStream(keyFile).read(encodedKey);

X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedKey);

KeyFactory kf = KeyFactory.getInstance(&quot;RSA&quot;);
PublicKey pk = kf.generatePublic(publicKeySpec);

Cipher rsa = Cipher.getInstance(&quot;RSA&quot;);

rsa.init(Cipher.ENCRYPT_MODE, pk);
OutputStream os = new CipherOutputStream(
        new FileOutputStream(&quot;encrypted.rsa&quot;), rsa);

Writer out = new OutputStreamWriter(os);
out.write(&quot;Very Large &#039;200 character&#039; :) message, that will be encrypted...&quot;);
out.close();
os.close();

&lt;/pre&gt;

Good luck!</description>
		<content:encoded><![CDATA[<p>Hi Walter,</p>
<p>
   You can encrypt many more than 200 characters <img src='http://www.dotkam.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
   But here is a quick (and dirty) example on how to do it:
</p>
<p>
   Let&#8217;s assume that you have generated a public key (or somebody gave you one) as a file &#8220;public.cer&#8221;, then you can do this:
</p>
<pre class="java">

File keyFile = new File("public.cer");
byte[] encodedKey = new byte[(int)keyFile.length()];

new FileInputStream(keyFile).read(encodedKey);

X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedKey);

KeyFactory kf = KeyFactory.getInstance("RSA");
PublicKey pk = kf.generatePublic(publicKeySpec);

Cipher rsa = Cipher.getInstance("RSA");

rsa.init(Cipher.ENCRYPT_MODE, pk);
OutputStream os = new CipherOutputStream(
        new FileOutputStream("encrypted.rsa"), rsa);

Writer out = new OutputStreamWriter(os);
out.write("Very Large '200 character' <img src='http://www.dotkam.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  message, that will be encrypted...");
out.close();
os.close();
</pre>
<p>Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Walter</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2914</link>
		<dc:creator>Walter</dc:creator>
		<pubDate>Wed, 10 Sep 2008 09:22:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2914</guid>
		<description>Can you please throw some light on how to encrypt a message more than 200 characters using the Public Certificate ?
Code snippet would be helpful.

Thanks.</description>
		<content:encoded><![CDATA[<p>Can you please throw some light on how to encrypt a message more than 200 characters using the Public Certificate ?<br />
Code snippet would be helpful.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: agentili</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2915</link>
		<dc:creator>agentili</dc:creator>
		<pubDate>Tue, 19 Aug 2008 20:17:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2915</guid>
		<description>Very useful, thank you!</description>
		<content:encoded><![CDATA[<p>Very useful, thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: xandra47</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2913</link>
		<dc:creator>xandra47</dc:creator>
		<pubDate>Sun, 13 Jul 2008 13:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2913</guid>
		<description>Very good tutorial! I was looking for something like this.

Xandra</description>
		<content:encoded><![CDATA[<p>Very good tutorial! I was looking for something like this.</p>
<p>Xandra</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sampat</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2912</link>
		<dc:creator>sampat</dc:creator>
		<pubDate>Mon, 19 May 2008 06:47:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2912</guid>
		<description>nice work buddy.</description>
		<content:encoded><![CDATA[<p>nice work buddy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarkucci</title>
		<link>http://www.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/comment-page-1/#comment-2911</link>
		<dc:creator>Sarkucci</dc:creator>
		<pubDate>Thu, 24 Apr 2008 17:55:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.dotkam.com/2008/04/22/creating-public-and-private-certificateskeys/#comment-2911</guid>
		<description>Thank you! This was quite simple - I needed to give somebody a public key and stumbled upon your great tutorial!</description>
		<content:encoded><![CDATA[<p>Thank you! This was quite simple &#8211; I needed to give somebody a public key and stumbled upon your great tutorial!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

