<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Bits and Bytes</title>
	<atom:link href="http://pa55word.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://pa55word.wordpress.com</link>
	<description>This blog is to compile the technical programming how to do's into one place in web</description>
	<lastBuildDate>Wed, 30 Jun 2010 12:02:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='pa55word.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Bits and Bytes</title>
		<link>http://pa55word.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://pa55word.wordpress.com/osd.xml" title="Bits and Bytes" />
	<atom:link rel='hub' href='http://pa55word.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Basics of WSDL in a simple language</title>
		<link>http://pa55word.wordpress.com/2010/06/30/basics-of-wsdl-in-a-simple-language/</link>
		<comments>http://pa55word.wordpress.com/2010/06/30/basics-of-wsdl-in-a-simple-language/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 11:58:28 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[webservice]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/?p=18</guid>
		<description><![CDATA[WSDL stands for Web Services Description Language WSDL is an XML document , describes Web services, used to locate web services, specifies operations web services exposes. WSDL Structure Major elements of a webservice Element Defines &#60;types&#62; The data types used by the web service &#60;message&#62; The messages used by the web service. Like function parameters. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=18&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>WSDL stands for Web Services Description Language<br />
WSDL is an XML document , describes Web services, used to locate web services, specifies operations web services exposes.</p>
<p><strong>WSDL Structure</strong><br />
Major elements of a webservice</p>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<th width="20%" align="left"><span style="font-size:small;">Element</span></th>
<th width="80%" align="left"><span style="font-size:small;">Defines</span></th>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">&lt;types&gt;</span></td>
<td valign="top"><span style="font-size:small;">The data types used by the web service</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">&lt;message&gt;</span></td>
<td valign="top"><span style="font-size:small;">The messages used by the web service. Like function parameters.<br />
</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">&lt;portType&gt;</span></td>
<td valign="top"><span style="font-size:small;">It describes a web service, the operations that can be performed, and the messages that are involved. Its the most important type. Equivalent to a interface.<br />
</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">&lt;binding&gt;</span></td>
<td valign="top"><span style="font-size:small;">The format and protocols used by the web service</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;"> &lt;service&gt;</span></td>
<td valign="top"><span style="font-size:small;">A collection of related ports<br />
</span></td>
</tr>
</tbody>
</table>
<p><span style="font-size:small;">A WSDL can also contain other elements, like extension elements, and a service element that makes it possible to group together the definitions of several web services in one single WSDL</span></p>
<p><strong><span style="font-size:small;">WSDL Example</span></strong></p>
<p>&lt;message name=&#8221;Request&#8221;&gt;</p>
<p><span style="font-size:small;">&lt;part name=&#8221;term&#8221; type=&#8221;string&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;/message&gt;</span></p>
<p><span style="font-size:small;">&lt;message name=&#8221;Response&#8221;&gt;</span></p>
<p><span style="font-size:small;"> &lt;part name=&#8221;value&#8221; type=&#8221;string&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;/message&gt;</span></p>
<p><span style="font-size:small;">&lt;message name=&#8221;Fault&#8221;&gt;</span></p>
<p><span style="font-size:small;"> &lt;part name=&#8221;value&#8221; type=&#8221;string&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;/message&gt;</span></p>
<p><span style="font-size:small;">&lt;portType name=&#8221;port&#8221;&gt;</span></p>
<p><span style="font-size:small;"> &lt;operation name=&#8221;method&#8221;&gt;</span></p>
<p><span style="font-size:small;"> &lt;input message=&#8221;Request&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;output message=&#8221;Response&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;fault message=&#8221;Fault&#8221;/&gt;<br />
</span></p>
<p><span style="font-size:small;"> &lt;/operation&gt;</span></p>
<p><span style="font-size:small;"> &lt;/portType&gt;</span></p>
<p><span style="font-size:small;"> &lt;binding type=&#8221;port&#8221; name=&#8221;b1&#8243;&gt;</span></p>
<p><span style="font-size:small;"> &lt;soap:binding style=&#8221;document&#8221;</span></p>
<p><span style="font-size:small;"> transport=&#8221;http://schemas.xmlsoap.org/soap/http&#8221; /&gt;</span></p>
<p><span style="font-size:small;"> &lt;operation&gt;</span></p>
<p><span style="font-size:small;"> &lt;soap:operation      soapAction=&#8221;http://example.com/port&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;input&gt;&lt;soap:body use=&#8221;literal&#8221;/&gt;&lt;/input&gt;</span></p>
<p><span style="font-size:small;"> &lt;output&gt;&lt;soap:body use=&#8221;literal&#8221;/&gt;&lt;/output&gt;</span></p>
<p><span style="font-size:small;"> &lt;/operation&gt;</span></p>
<p><span style="font-size:small;"> &lt;/binding&gt;</span></p>
<p><span style="font-size:small;">&lt;service name=&#8221;Service&#8221;&gt;</span></p>
<p><span style="font-size:small;"> &lt;port name=&#8221;Port&#8221; binding=&#8221;b1&#8243;&gt;</span></p>
<p><span style="font-size:small;"> &lt;soap:address location=&#8221;http://loaclhost:8080/example&#8221;/&gt;</span></p>
<p><span style="font-size:small;"> &lt;/port&gt;</span></p>
<p><span style="font-size:small;">&lt;/service&gt;<br />
</span></p>
<p><span style="font-size:small;">In this example the<strong> &lt;portType&gt;</strong> element defines the name of a <strong>port</strong>, and the name of an <strong>operation</strong>. The operation has an <strong>input message</strong> and an <strong>output message</strong> and a fault message. The<strong> &lt;message&gt;</strong> elements define the <strong>parts</strong> of each message and  the associated data types.</span><span style="font-size:small;">The request-response type is the most common operation type, but WSDL defines four types: </span></p>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<th width="30%" align="left"><span style="font-size:small;">Type</span></th>
<th width="70%" align="left"><span style="font-size:small;">Definition</span></th>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">One-way</span></td>
<td valign="top"><span style="font-size:small;">The operation can receive a message but will not return a      response</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">Request-response</span></td>
<td valign="top"><span style="font-size:small;">The operation can receive a request and will return a      response</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">Solicit-response</span></td>
<td valign="top"><span style="font-size:small;">The operation can send a request and will wait for a      response</span></td>
</tr>
<tr>
<td valign="top"><span style="font-size:small;">Notification</span></td>
<td valign="top"><span style="font-size:small;">The operation can send a message but will not wait for a      response</span></td>
</tr>
</tbody>
</table>
<p><span style="font-size:small;">The<strong> binding</strong> element has two attributes &#8211; name and type. </span></p>
<p><span style="font-size:small;">The name attribute (you can use any name you want) defines the name of the  binding, and the type attribute points to the port for the binding.</span></p>
<p><span style="font-size:small;">The <strong>soap:binding</strong> element has two attributes &#8211; style and transport.</span></p>
<p><span style="font-size:small;">The style attribute can be &#8220;rpc&#8221; or &#8220;document&#8221;. In this case we use document. The transport attribute defines the SOAP protocol to use. In this case we use HTTP.</span></p>
<p><span style="font-size:small;">The<strong> operation</strong> element defines each operation that the port exposes.</span></p>
<p><span style="font-size:small;">For each operation the corresponding SOAP action has to be defined. You must  also specify how the input and output are encoded. In this case we use &#8220;literal&#8221;.</span></p>
<p><span style="font-size:small;">The service</span><span style="font-size:small;"> element defines the ports supported by the Web service. For each of the supported protocols, there is one port </span><span style="font-size:small;">element.</span><br />
Port, specifies an address for a binding, thus defining a         single communication endpoint.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=18&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2010/06/30/basics-of-wsdl-in-a-simple-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get your java keystore/truststore from pem files</title>
		<link>http://pa55word.wordpress.com/2009/01/21/how-to-get-your-java-keystoretruststore-from-pem-files/</link>
		<comments>http://pa55word.wordpress.com/2009/01/21/how-to-get-your-java-keystoretruststore-from-pem-files/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 11:44:59 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[TLS]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/?p=12</guid>
		<description><![CDATA[Requirement : Create JKS keystore and truststore out of certificate and private key files given in pem format. Try to open the certificate and key files and it contains ASCII text that starts with &#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;, then it is in PEM format. Using keytool in java, when a keystore is created it already has the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=12&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Requirement : Create JKS keystore and truststore out of certificate and private key files given in pem format.</p>
<p>Try to open the certificate and key files and it contains ASCII text that starts with &#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;, then it is in PEM format.</p>
<p>Using keytool in java, when a keystore is created it already has the private key in it. Keytool does not allow us to import a private key into a keystore. Thus we need to use OpenSSL for this but OpenSSL creates the keystore in pkcs12 format. So we use jetty to convert our pkcs12 into jks format.</p>
<p>OpenSSL for Windows is available from <a class="external free" title="http://www.slproweb.com/products/Win32OpenSSL.html" rel="nofollow" href="http://www.slproweb.com/products/Win32OpenSSL.html">http://www.slproweb.com/products/Win32OpenSSL.html</a>.</p>
<p>Keystore to be created : keystore.pkcs12, Certificate File : test.cert.pem, PrivateKey File : test.key.pem.<br />
<strong>openssl pkcs12 -export -out keystore.pkcs12 -in test.cert.pem -inkey test.key.pem</strong><br />
Enter the appropriate password. Now using jetty we can convert the pkcs12 keystore into jks keystore (keystore.jks).<br />
<strong>java -cp c:\jetty\lib\jetty-6.1.1.jar org.mortbay.jetty.security.PKCS12Import keystore.pkcs12 keystore.jks</strong></p>
<p>Now to create truststore file.<br />
<strong>keytool -import -alias test -file test.cert.pem -keystore truststore</strong></p>
<p>where truststore is the new TrustStore in jks format. You can import as many other certificates as you need to trust into the truststore. Give the password and type y when asked trust the certificate.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=12&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2009/01/21/how-to-get-your-java-keystoretruststore-from-pem-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>Need to free that port</title>
		<link>http://pa55word.wordpress.com/2008/01/23/need-to-free-that-port/</link>
		<comments>http://pa55word.wordpress.com/2008/01/23/need-to-free-that-port/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 09:57:33 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[Windows Tips]]></category>
		<category><![CDATA[port]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/2008/01/23/need-to-free-that-port/</guid>
		<description><![CDATA[Started a java app and here comes jvm_bind issue. Use netstat -a in command prompt to discover the ports in use and the process ids. Then kill our process to free that port.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=11&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Started a java app and here comes jvm_bind issue. Use</p>
<p>netstat -a</p>
<p>in command prompt to discover the ports in use and the process ids. Then kill our process to free that port.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pa55word.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pa55word.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=11&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2008/01/23/need-to-free-that-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>Cool Java Secure Socket Resources</title>
		<link>http://pa55word.wordpress.com/2007/11/23/cool-java-secure-socket-resources/</link>
		<comments>http://pa55word.wordpress.com/2007/11/23/cool-java-secure-socket-resources/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 14:02:23 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[TLS]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/2007/11/23/cool-java-secure-socket-resources/</guid>
		<description><![CDATA[ http://java.sun.com/docs/books/tutorial/networking/sockets/index.html http://www.ibm.com/developerworks/edu/j-dw-javajsse-i.html You require a free ibm id for this above. http://www.ddj.com/java/184404478?pgno=1  I will be adding more later.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=10&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> <a HREF="http://java.sun.com/docs/books/tutorial/networking/sockets/index.html">http://java.sun.com/docs/books/tutorial/networking/sockets/index.html</a></p>
<p><a HREF="http://www.ibm.com/developerworks/edu/j-dw-javajsse-i.html">http://www.ibm.com/developerworks/edu/j-dw-javajsse-i.html</a></p>
<p>You require a free ibm id for this above.</p>
<p><a HREF="http://www.ddj.com/java/184404478?pgno=1">http://www.ddj.com/java/184404478?pgno=1 </a></p>
<p>I will be adding more later.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pa55word.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pa55word.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=10&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2007/11/23/cool-java-secure-socket-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>Secure Sockets in Java</title>
		<link>http://pa55word.wordpress.com/2007/11/23/secure-sockets-in-java/</link>
		<comments>http://pa55word.wordpress.com/2007/11/23/secure-sockets-in-java/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 13:56:17 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[TLS]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/2007/11/23/secure-sockets-in-java/</guid>
		<description><![CDATA[ In plain words secure sockets using javax.net.ssl package. We need secure socket to connect to an ip and port with security. Thus Secure Socket is like a door which we need to go inside apartment whose address is its ip and door number is the port. Now how to we open the door. We need keys. Certificates are keys which is verified and signed by some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=8&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> In plain words secure sockets using javax.net.ssl package.</p>
<p>We need secure socket to connect to an ip and port with security. Thus Secure Socket is like a door which we need to go inside apartment whose address is its ip and door number is the port. Now how to we open the door. We need keys.</p>
<p>Certificates are keys which is verified and signed by some authority(Certifying Authority &#8211; CA) as good keys.</p>
<p>Now we have more than one key. So we use a keystore. Its like key-rings holding all your keys in one place. KeyStore Class can be used to represent a certificate in java. You upload your keystore made by java keytool into this object.</p>
<p>KeyManagerFactory class does the job of managing your key ring. Give that to your SSLContextClass and from that you can get the SSLSocketFactory. Using SSLSocketFactory we finally get our SSLSocket.</p>
<p>That much code in place the problem of how to trust others keys which they(servers) send to verify themselves while communicating comes up. We will put those keys in another keystore and call it our trust store. Again put the trust store in a KeyStore object and put it a TrustManagerFactory and give it to the context.</p>
<p>Of-course the question how to get keystore and truststore with certificates is still there. <a TITLE="Quick and easy certificates for TLS" HREF="http://pa55word.wordpress.com/2007/11/23/quick-and-easy-certificates-for-tls/">Click this link for that.</a></p>
<p>The folowing method creates a secure socket with client authentication.</p>
<blockquote><p>public SSLSocket createSecureSocket(String keyStore, String keyStorePwd, String trustStore,<br />
String trustStorePwd) throws IOException {<br />
// create 2 JKS keystores for keystore and truststore<br />
KeyStore clientKeyStore = null;<br />
KeyStore clientTrustStore = null;<br />
try {<br />
clientKeyStore = KeyStore.getInstance( &#8220;JKS&#8221;);<br />
clientTrustStore = KeyStore.getInstance( &#8220;JKS&#8221;) ;<br />
} catch (KeyStoreException e) {<br />
e.printStackTrace();<br />
}<br />
//convert keystore pwd into char array and load the client keystore made with keytool into<br />
//one keystore object.<br />
char[] keyStorePwdArray = keyStorePwd.toCharArray();<br />
try {<br />
clientKeyStore.load(new FileInputStream(keyStore), keyStorePwdArray);<br />
} catch (NoSuchAlgorithmException e1) {<br />
e1.printStackTrace();<br />
} catch (CertificateException e1) {<br />
e1.printStackTrace();<br />
}<br />
//convert truststore pwd into char array and load the client truststore made with keytool into<br />
//other keystore object.<br />
char[] trustStorePwdArray = trustStorePwd.toCharArray();<br />
try {<br />
clientTrustStore.load(new FileInputStream(trustStore), trustStorePwdArray);<br />
} catch (NoSuchAlgorithmException e1) {<br />
e1.printStackTrace();<br />
} catch (CertificateException e1) {<br />
e1.printStackTrace();<br />
}<br />
// create the key manager and trust manager factories.<br />
KeyManagerFactory kmf = null;<br />
TrustManagerFactory tmf = null;<br />
try {<br />
kmf = KeyManagerFactory.getInstance( &#8220;SunX509&#8243; );<br />
tmf = TrustManagerFactory.getInstance(&#8220;SunX509&#8243;);<br />
} catch (NoSuchAlgorithmException e) {<br />
e.printStackTrace();<br />
}<br />
//load client keystore and pwd to key manager factory.<br />
try {<br />
kmf.init(clientKeyStore, keyStorePwdArray);<br />
} catch (KeyStoreException e1) {<br />
e1.printStackTrace();<br />
} catch (NoSuchAlgorithmException e1) {<br />
e1.printStackTrace();<br />
} catch (UnrecoverableKeyException e1) {<br />
e1.printStackTrace();<br />
}<br />
// load client truststore into trust manager factory.<br />
try {<br />
tmf.init(clientTrustStore);<br />
} catch (KeyStoreException e) {<br />
e.printStackTrace();<br />
}<br />
// create sslcontext object and load both the facotries into it.<br />
SSLContext ctx=null;<br />
try {<br />
ctx = SSLContext.getInstance( &#8220;TLS&#8221; );<br />
} catch (NoSuchAlgorithmException e) {<br />
e.printStackTrace();<br />
}<br />
try {<br />
ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);<br />
} catch (KeyManagementException e) {<br />
e.printStackTrace();<br />
}<br />
// Get our socket factory from context and then get the socket.<br />
SSLSocketFactory factory = ctx.getSocketFactory();<br />
SSLSocket socket = (SSLSocket)factory.createSocket();<br />
return socket;<br />
}<em><br />
</em><em><br />
</em></p>
</blockquote>
<p>Now we need to open a connection.<br />
socket.connect(new InetSocketAddress(&#8220;localhost&#8221;, 9999),10000000);<br />
or<br />
SSLSocketFactory sf = sslContext.getSocketFactory();<br />
Socket socket = sf.createSocket(host, port);</p>
<p>To create a server socket use the same method but use servers keystore and truststore.<br />
Get the context object ctx.<br />
SSLServerSocketFactory ssf = ctx.getServerSocketFactory();<br />
ServerSocket ss = ssf.createServerSocket( 6660 );</p>
<p>Note : If you are really bothered by the numerous try catch statements just put the code in one try block and write catch statements at the end. I write really good <br />
system.out.printlns in catch blocks during the first attempt just to know where I am going wrong. Later I combine them.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pa55word.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pa55word.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=8&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2007/11/23/secure-sockets-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick and easy certificates for TLS</title>
		<link>http://pa55word.wordpress.com/2007/11/23/quick-and-easy-certificates-for-tls/</link>
		<comments>http://pa55word.wordpress.com/2007/11/23/quick-and-easy-certificates-for-tls/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 13:50:57 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[TLS]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[keystore]]></category>
		<category><![CDATA[keytool]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/2007/11/23/quick-and-easy-certificates-for-tls/</guid>
		<description><![CDATA[When urgently you need some keystores and truststores to test out some security related java code this is a useful bat file to have. Copy the code below and create a bat file. run it and you got your stuff. keytool -genkey -alias serverkeys -keyalg RSA -keystore server.k eystore -storepass 123456 -keypass 123456 -dname &#8220;CN=localhost, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=9&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When urgently you need some keystores and truststores to test out some security related java code this is a useful bat file to have. Copy the code below and create a bat file. run it and you got your stuff.</p>
<blockquote><p><em>keytool -genkey -alias serverkeys -keyalg RSA -keystore server.k<br />
eystore -storepass 123456 -keypass 123456 -dname &#8220;CN=localhost, OU=MYOU, O=MYORG, L=MYCITY, ST=M<br />
YSTATE, C=MY&#8221;</em></p>
<p><em><br />
keytool -export -alias serverkeys -keystore server.keystore -stor<br />
epass 123456 -file server.cer</em></p>
<p><em><br />
keytool -genkey -alias clientkeys  -keyalg RSA -keystore client.k<br />
eystore -storepass 123456 -keypass 123456 -dname &#8220;CN=localhost, OU=MYOU, O=MYORG, L=MYCITY, S=MY<br />
STATE, C=MY&#8221;</em></p>
<p><em><br />
keytool -export -alias clientkeys -keystore client.keystore -stor<br />
epass 123456 -file client.cer</em></p>
<p><em><br />
keytool -import -v -keystore client.truststore  -storepass 123456<br />
-file server.cer</em></p>
<p><em><br />
keytool -import -v -keystore server.truststore  -storepass 123456<br />
-file client.cer</em></p></blockquote>
<p>It generates a keystore called  server.keystore with password 123456. Then it creates server certificate server.cer.</p>
<p>Then it  generates a keystore called  client.keystore with password 123456. Creates a client certificate named client.cer</p>
<p>Next it imports server certificate into client truststore and client certificate into server truststore.</p>
<p>These are self signed certificates. Good for internal use. You can use open ssl<br />
and create certificates. But this bat file is short and sweet for immediate use.<br />
When you paste it you do have to be careful about keywords not getting split up like wordpress does.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pa55word.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pa55word.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=9&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2007/11/23/quick-and-easy-certificates-for-tls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
		<item>
		<title>5 eclipse plugins for software quality</title>
		<link>http://pa55word.wordpress.com/2007/08/17/5-eclipse-plugins-for-software-quality/</link>
		<comments>http://pa55word.wordpress.com/2007/08/17/5-eclipse-plugins-for-software-quality/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 13:04:07 +0000</pubDate>
		<dc:creator>sun</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Quality]]></category>
		<category><![CDATA[software metrics]]></category>
		<category><![CDATA[code quality]]></category>
		<category><![CDATA[eclipse plugin]]></category>

		<guid isPermaLink="false">http://pa55word.wordpress.com/2007/08/17/5-eclipse-plugins-for-software-quality/</guid>
		<description><![CDATA[This is a video podcast by Paul Duvall and Levent Gurses, discussing Levent’s presentation at the Better Software Conference. JDepend4Eclipse, Checkstyle, Coverlipse, PMD, and Metrics eclipse plugins are discussed. All  these plugins are for software metrics which will help in code quality. Checkstyle is a plugin which I have used and found useful. We can give a xml file based rule (coding std) to the plugin and while writing code it will highlight the checkstyle errors. This avoided a lot of headaches when compared to times the code went into the automated build process and then all your checkstyle errors were highlighted before the world. JDepend4Eclipse &#8211; traverses Java class file [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=4&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is a video podcast by Paul Duvall and Levent Gurses, discussing Levent’s presentation at the Better Software Conference. JDepend4Eclipse, Checkstyle, Coverlipse, PMD, and Metrics eclipse plugins are discussed.</p>
<p>All  these plugins are for software metrics which will help in code quality.</p>
<p><strong>Checkstyle</strong> is a plugin which I have used and found useful. We can<br />
give a xml file based rule (coding std) to the plugin and while writing<br />
code it will highlight the checkstyle errors. This avoided a lot of headaches<br />
when compared to times the code went into the automated build process<br />
and then all your checkstyle errors were highlighted before the world.</p>
<p><strong>JDepend4Eclipse</strong> &#8211; traverses Java class file directories and generates design metrics for each Java package.</p>
<p><strong>Coverlipse</strong> &#8211; djunit is another plugin which does the same job of showing your unit test coverage.</p>
<p><strong>PMD </strong> &#8211; Helps with code duplication.</p>
<p><strong>Metrics</strong> &#8211; Measures complexity.</p>
<p><a HREF="http://www.testearly.com/2007/06/11/vidcast-improving-code-quality-with-eclipse-and-its-plugins/">The video pod cast I was talking about before</a></p>
<p><a HREF="http://www-128.ibm.com/developerworks/java/library/j-ap01117/index.html">An article and tutorial about the five plugins by ibm developer works :- Automation for the people by Paul Duvall</a></p>
<p>To download the free plugins use the links below.</p>
<p><a HREF="http://pmd.sourceforge.net/eclipse/">http://pmd.sourceforge.net/eclipse/</a></p>
<p><a HREF="http://andrei.gmxhome.de/jdepend4eclipse/index.html">http://andrei.gmxhome.de/jdepend4eclipse/index.html </a></p>
<p><a HREF="http://coverlipse.sourceforge.net/index.php">http://coverlipse.sourceforge.net/index.php</a></p>
<p><a HREF="http://metrics.sourceforge.net/">http://metrics.sourceforge.net/</a></p>
<p><a HREF="http://eclipse-cs.sourceforge.net/">http://eclipse-cs.sourceforge.net/ </a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/pa55word.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/pa55word.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/pa55word.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/pa55word.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/pa55word.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=pa55word.wordpress.com&amp;blog=1492994&amp;post=4&amp;subd=pa55word&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://pa55word.wordpress.com/2007/08/17/5-eclipse-plugins-for-software-quality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8dfd33724157102562bd013251affe66?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sunray</media:title>
		</media:content>
	</item>
	</channel>
</rss>
