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

<channel>
	<title>Codedrop™ Weblog &#187; Programming</title>
	<atom:link href="http://www.codedrop.ca/blog/archives/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codedrop.ca/blog</link>
	<description>Drop'n some code and other tech tidbits...</description>
	<lastBuildDate>Sun, 01 Jan 2012 07:48:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Use Java to disable certificate validation in an HTTPS Connection</title>
		<link>http://www.codedrop.ca/blog/archives/240</link>
		<comments>http://www.codedrop.ca/blog/archives/240#comments</comments>
		<pubDate>Thu, 22 Dec 2011 15:26:57 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=240</guid>
		<description><![CDATA[By default, accessing an HTTPS URL using the URL class results in an exception if the server&#8217;s certificate chain cannot be validated has not previously been installed in the truststore. If you want to disable the validation of certificates for testing purposes, you need to override the default trust manager with one that trusts all [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>By default, accessing an HTTPS URL using the URL class results in an exception if the server&#8217;s certificate chain cannot be validated has not previously been installed in the truststore.  If you want to disable the validation of certificates for testing purposes, you need to override the default trust manager with one that trusts all certificates.</p>
<div>
<pre>// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
    new X509TrustManager() {
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return null;
        }
        public void checkClientTrusted(
            java.security.cert.X509Certificate[] certs, String authType) {
        }
        public void checkServerTrusted(
            java.security.cert.X509Certificate[] certs, String authType) {
        }
    }
};

// Install the all-trusting trust manager
try {
    SSLContext sc = SSLContext.getInstance("SSL");
    sc.init(null, trustAllCerts, new java.security.SecureRandom());
    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} catch (Exception e) {
}

// Now you can access an https URL without having the certificate
// in the truststore
try {
    URL url = new URL("https://hostname/index.html");
} catch (MalformedURLException e) {
}</pre>
</div>
</div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Use+Java+to+disable+certificate+validation+in+an+HTTPS+Connection+http%3A%2F%2Ftinyurl.com%2Fctoqldb" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Use+Java+to+disable+certificate+validation+in+an+HTTPS+Connection+http%3A%2F%2Ftinyurl.com%2Fctoqldb" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/240/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crontab Reference</title>
		<link>http://www.codedrop.ca/blog/archives/233</link>
		<comments>http://www.codedrop.ca/blog/archives/233#comments</comments>
		<pubDate>Wed, 29 Sep 2010 15:58:54 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Build Automation]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/233</guid>
		<description><![CDATA[I continually forget the format for a crontab entry&#8230; here&#8217;s a quick reference for those of you who do too! Tweet This Post]]></description>
			<content:encoded><![CDATA[<p>I continually forget the format for a crontab entry&#8230; here&#8217;s a quick reference for those of you who do too!</p>
<p><img style="max-width: 800px;" src="http://blog.linuxvin.com/wp-content/uploads/2010/07/crontab-syntax-300x121.gif" /></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=29a30767-9dc6-8500-a169-40c2834a6a03" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Crontab+Reference+http%3A%2F%2Ftinyurl.com%2F3zrywxb" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Crontab+Reference+http%3A%2F%2Ftinyurl.com%2F3zrywxb" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/233/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails and Oracle XMLDB (XMLType)</title>
		<link>http://www.codedrop.ca/blog/archives/223</link>
		<comments>http://www.codedrop.ca/blog/archives/223#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:09:28 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Grails]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/223</guid>
		<description><![CDATA[Trying to integrate support for Oracle XMLDB in a grails app didn&#8217;t turn out to be as straightforward as you might think.&#160; By putting the xmlparserv2.jar file in the $GRAILS_HOME/lib folder I was suddenly presented with SAX parse errors&#8230; Luckily I stumbled across this post by Graeme Rocher who had a similar problem and identified [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to integrate support for Oracle XMLDB in a grails app didn&#8217;t turn out to be as straightforward as you might think.&nbsp; By putting the xmlparserv2.jar file in the $GRAILS_HOME/lib folder I was suddenly presented with SAX parse errors&#8230; </p>
<p>Luckily I stumbled across this <a href="http://archive.montage.codehaus.org/lists/org.codehaus.grails.scm/msg/13379562.1199702277466.JavaMail.haus-jira@codehaus01.managed.contegix.com">post</a> by Graeme Rocher who had a similar problem and identified how to resolve it&#8230;</p>
<p>Essentially to solve the problem, you need to make sure that library is only picked up at runtime, and not compile time.&nbsp;&nbsp; You need to put the xmlparserv2.jar on the system classpath instead of the lib directory.</p>
<p>1) When running standalone from grails command line:<br />&nbsp;grails -cp lib/runtime/xmlparserv2.jar run-app or modifying the CLASSPATH environment variable</p>
<p>2) When running from within a container, add the .jar to the lib folder<br />(ie: $TOMCAT_HOME/lib)</p>
<p>Another possible solution is documented <a href="http://hartsock.blogspot.com/2009/04/grails-11-jboss-42x-and-oracle.html">here</a>.</p>
<p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=d20fa009-7e34-866b-b6f3-71f98f5dd861" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Grails+and+Oracle+XMLDB+%28XMLType%29+http%3A%2F%2Ftinyurl.com%2F4vgf3da" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Grails+and+Oracle+XMLDB+%28XMLType%29+http%3A%2F%2Ftinyurl.com%2F4vgf3da" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/223/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SelectorGadget makes identifying page elements a breeze!</title>
		<link>http://www.codedrop.ca/blog/archives/208</link>
		<comments>http://www.codedrop.ca/blog/archives/208#comments</comments>
		<pubDate>Tue, 12 Jan 2010 04:51:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/208</guid>
		<description><![CDATA[A recent railscast pointed me at a handy tool that has helped tremendously in speeding up my UI development efforts.&#160; In past, I would use FireBug to highlight items on a page and identify the associated id / class.&#160; This worked ok, but did not aid in narrowing down my selector in the efficient mannter [...]]]></description>
			<content:encoded><![CDATA[<p>A recent railscast pointed me at a handy tool that has helped tremendously in speeding up my UI development efforts.&nbsp; In past, I would use FireBug to highlight items on a page and identify the associated id / class.&nbsp; This worked ok, but did not aid in narrowing down my selector in the efficient mannter this one does.&nbsp; You can easily select/deselect fields on your page and dynamically generate your css selector.&nbsp; Very cool!.. I encourage you to check it out!</p>
<p><a href="http://www.selectorgadget.com/">Introducing SelectorGadget: point and click CSS selectors</a></p>
<blockquote></blockquote>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=93ba76b4-1f55-8a34-9ed4-e23a6a63ca97" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=SelectorGadget+makes+identifying+page+elements+a+breeze%21+http%3A%2F%2Ftinyurl.com%2F4rz496o" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=SelectorGadget+makes+identifying+page+elements+a+breeze%21+http%3A%2F%2Ftinyurl.com%2F4rz496o" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/208/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add some color to your Capistrano scripts</title>
		<link>http://www.codedrop.ca/blog/archives/200</link>
		<comments>http://www.codedrop.ca/blog/archives/200#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:05:15 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=200</guid>
		<description><![CDATA[The beauty of ruby makes it simple to add some colorful syntax highlighting to log messages that are displayed in your capistrano scripts.  Here&#8217;s a chunk of code I added to my utility.rb file that is included by my capfile that performs the magic. def colorize(text, color_code) "#{color_code}#{text}\033[0m" end def red(text); colorize(text, "\033[31m"); end def [...]]]></description>
			<content:encoded><![CDATA[<p>The beauty of ruby makes it simple to add some colorful syntax highlighting to log messages that are displayed in your capistrano scripts.  Here&#8217;s a chunk of code I added to my utility.rb file that is included by my capfile that performs the magic.</p>
<p><code><br />
def colorize(text, color_code)<br />
"#{color_code}#{text}\033[0m"<br />
end</code><br />
<code><br />
def red(text); colorize(text, "\033[31m"); end<br />
def boldred(text); colorize(text, "\033[1;31m"); end<br />
def green(text); colorize(text, "\033[32m"); end<br />
def boldgreen(text); colorize(text, "\033[1;32m"); end<br />
def yellow(text); colorize(text, "\033[33m"); end<br />
def boldyellow(text); colorize(text, "\033[1;33m"); end<br />
def blue(text); colorize(text, "\033[34m"); end<br />
def boldblue(text); colorize(text, "\033[1;34m"); end<br />
def purple(text); colorize(text, "\033[35m"); end<br />
def boldpurple(text); colorize(text, "\033[1;35m"); end<br />
def cyan(text); colorize(text, "\033[36m"); end<br />
def boldcyan(text); colorize(text, "\033[1;36m"); end<br />
def white(text); colorize(text, "\033[37m"); end<br />
def boldwhite(text); colorize(text, "\033[1;37m"); end<br />
</code><br />
<code><br />
def inform(text); green(text); end<br />
def highlight(text); boldgreen(text); end<br />
def warning(text); yellow(text); end<br />
def alert(text); red(text); end<br />
def section(text); "\n\n#{"*" * 50}\n#{text}\n#{"*" * 50}";<br />
</code><br />
Now by utilizing the wrapper methods like this:<br />
<code><br />
task :testconfig do<br />
logoutputDir = Logging.initialize("#{$deployDir}/logs", $envNameName, $envNameNum)<br />
Logging.info inform("*" * 75)<br />
Logging.info inform(" Starting... ")<br />
Logging.info "      Env: " + highlight('development')<br />
Logging.info "     Date: " + highlight(Time.now.to_s)<br />
Logging.info "     User: " + highlight('jsmith')<br />
Logging.info " Logs Dir: " + highlight('/tmp/projectX/log')<br />
Logging.info inform("*" * 75)<br />
Logging.info inform(".. informational message ...")<br />
Logging.info warning(".. warning message ...")<br />
Logging.info alert(".. alert message ...")<br />
Logging.info highlight(".. highlighted message ..")<br />
Logging.info inform("*" * 75)<br />
Logging.info inform(" Done! ")<br />
Logging.info " Date: " + highlight(Time.now.to_s)<br />
Logging.info " Dist: " + highlight('/tmp/projectX/dist')<br />
Logging.info inform("*" * 75)<br />
end<br />
</code><br />
You'll get pretty output like this:</p>
<div id="attachment_201" class="wp-caption alignnone" style="width: 310px"><a href="http://www.codedrop.ca/blog/wp-content/uploads/2009/11/syntax_highlight.gif"><img class="size-medium wp-image-201" title="syntax_highlight" src="http://www.codedrop.ca/blog/wp-content/uploads/2009/11/syntax_highlight-300x136.gif" alt="Sample console output" width="300" height="136" /></a><p class="wp-caption-text">Sample console output</p></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Add+some+color+to+your+Capistrano+scripts+http%3A%2F%2Ftinyurl.com%2F3buuxxz" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Add+some+color+to+your+Capistrano+scripts+http%3A%2F%2Ftinyurl.com%2F3buuxxz" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/200/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capistrano Callbacks</title>
		<link>http://www.codedrop.ca/blog/archives/196</link>
		<comments>http://www.codedrop.ca/blog/archives/196#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:51:10 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Build Automation]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Capistrano]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/196</guid>
		<description><![CDATA[Neat way to pre-initalize something in capistrano before a task is run on :start do verifyParametersAndInitialize()end callback options: :before, triggered before a task is invoked :after, triggered after a task is invoked :start, triggered before a top-level task is invoked via the command-line :finish, triggered when a top-level task completes :load, triggered after all recipes [...]]]></description>
			<content:encoded><![CDATA[<p>Neat way to pre-initalize something in capistrano before a task is run</p>
<p><code>on :start do<br />  verifyParametersAndInitialize()<br />end</code></p>
<p>callback options:
<ol>
<li> :before, triggered before a task is invoked</li>
<li> :after, triggered after a task is invoked</li>
<li> :start, triggered before a top-level task is invoked via the command-line</li>
<li> :finish, triggered when a top-level task completes</li>
<li> :load, triggered after all recipes have loaded</li>
<li>:exit, triggered after all tasks have completed</li>
</ol>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=4f2cdfcc-4c28-8945-8c89-a12168624c3b" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Capistrano+Callbacks+http%3A%2F%2Ftinyurl.com%2F42lr3gj" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Capistrano+Callbacks+http%3A%2F%2Ftinyurl.com%2F42lr3gj" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/196/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automate your non-rails db migrations with Capistrano and AutoPatch</title>
		<link>http://www.codedrop.ca/blog/archives/191</link>
		<comments>http://www.codedrop.ca/blog/archives/191#comments</comments>
		<pubDate>Tue, 10 Nov 2009 20:53:38 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Build Automation]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Migrations]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/?p=191</guid>
		<description><![CDATA[After working in a rails environment for the past year I found it terribly difficult to go back to traditional database deployment / upgrade practices. Migrations are a beautiful way to properly version, co-ordinate and apply the changes you need to your various database environments.  I never knew of a way to do this in [...]]]></description>
			<content:encoded><![CDATA[<p>After working in a rails environment for the past year I found it terribly difficult to go back to traditional database deployment / upgrade practices.</p>
<p>Migrations are a beautiful way to properly version, co-ordinate and apply the changes you need to your various database environments.  I never knew of a way to do this in a non-rails environment, until now. Step in <a href="http://autopatch.sourceforge.net/index.php">AutoPatch</a>.</p>
<p>Some alternatives to AutoPatch exist such as <a href="http://migrate4j.sourceforge.net/">migrate4j</a> and <a href="http://www.liquibase.org/">Liquibase</a>. Each with their own flavor of how to tackle the problem.  AutoPatch was the winner for me as you don&#8217;t have to write your migrations in some custom DSL (xml in the case of Liquibase, or java for migrate4j).  Our existing .sql scripts worked just fine!</p>
<p>Our shop is currently using <a href="http://www.capify.org/index.php/Capistrano">Capistrano</a> for deployments.  Blending Autopatch with Capistrano was relatively straightforward.  Below are two sample tasks that can be added to facilitate AutoPatch&#8217;s cmd line info and migrate calls.</p>
<p><code> desc "Display database migration levels."<br />
task :dbinfo do<br />
cmdAPClasspath = "#{deployDir}/applications/database/lib/oracle/ojdbc14_g.jar" \<br />
+ ":#{deployDir}/dist/prepare/database" \<br />
+ ":#{deployDir}/lib/java/tk-autopatch-1.2-b-cvs.jar" \<br />
+ ":#{deployDir}/lib/java/log4j-1.2.8.jar" \<br />
+ ":#{deployDir}/lib/java/commons-logging-1.0.3.jar" \<br />
+ ":#{deployDir}/lib/java/commons-collections-3.2.1.jar" \<br />
+ ":#{deployDir}/lib/java/commons-lang-2.2.jar" \<br />
+ ":#{deployDir}/lib/java/tk-util-1.1.2.jar"<br />
cmdAPPatchInfo = "java -cp #{cmdAPClasspath} " \<br />
+ "com.tacitknowledge.util.migration.jdbc.MigrationInformation </code><code>#{systemName}</code><code>"<br />
system(cmdAPPatchInfo)<br />
end</code></p>
<p><code>desc "Apply database migrations."<br />
task :dbmigrate do<br />
cmdAPClasspath = "#{deployDir}/applications/database/lib/oracle/ojdbc14_g.jar" \<br />
+ ":#{deployDir}/dist/prepare/database" \<br />
+ ":#{deployDir}/lib/java/tk-autopatch-1.2-b-cvs.jar" \<br />
+ ":#{deployDir}/lib/java/log4j-1.2.8.jar" \<br />
+ ":#{deployDir}/lib/java/commons-logging-1.0.3.jar" \<br />
+ ":#{deployDir}/lib/java/commons-collections-3.2.1.jar" \<br />
+ ":#{deployDir}/lib/java/commons-lang-2.2.jar" \<br />
+ ":#{deployDir}/lib/java/tk-util-1.1.2.jar"<br />
cmdAPPatch<code>I</code>nfo = "java -cp #{cmdAPClasspath} " \<br />
+ "com.tacitknowledge.util.migration.jdbc.StandaloneMigrationLauncher #{systemName}"<br />
system(cmdAPPatchInfo)<br />
end</code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Automate+your+non-rails+db+migrations+with+Capistrano+and+AutoPatch+http%3A%2F%2Ftinyurl.com%2F3ly257l" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Automate+your+non-rails+db+migrations+with+Capistrano+and+AutoPatch+http%3A%2F%2Ftinyurl.com%2F3ly257l" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/191/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL Certificate Formats / Conversion</title>
		<link>http://www.codedrop.ca/blog/archives/131</link>
		<comments>http://www.codedrop.ca/blog/archives/131#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:45:55 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/131</guid>
		<description><![CDATA[This past week has left me having to learn much more about https certificates then I ever thought I would care to know&#8230;&#160;&#160; Here&#8217;s a synopsis of some of the highlights of my learnings as pulled from various resources on the web. OpenSSL supports several certificate formats. Certificates are based on the DSA signature algorithm [...]]]></description>
			<content:encoded><![CDATA[<p>This past week has left me having to learn much more about https certificates then I ever thought I would care to know&#8230;&nbsp;&nbsp; Here&#8217;s a synopsis of some of the highlights of my learnings as pulled from various resources on the web.</p>
<p>OpenSSL supports several certificate formats. Certificates are based on the DSA signature algorithm and the RSA algorithm for public-key cryptography according to PKCS algorithms.&nbsp; The certificate format depends on the application, as there is no agreement on file format standards.</p>
<p>Private keys are usually available in the PEM and DER format. The related files have names of the following type:</p>
<p>*key-rsa.pem for pem files<br />*key-rsa.der for der files</p>
<p>For OpenSSL applications, the PEM format should suffice. For Java applications, the DER format might be more suitable for importing the private key and certificates.</p>
<p>For certificates, the available formats are PEM, DER and PKCS12 with file names of the following type:</p>
<p>*cert.pem for pem files<br />*cert.der for der files<br />*cert.p12 for pkcs12 files</p>
<p>In general, the PEM formats are mostly used in the Unix world, PCKS12 in the Microsoft world and DER in the Java world.</p>
<p>Certificate files are ASN.1-encoded objects that may be encrypted according to DES (Data Encryption Standard). The files can optionally be encrypted using a symmetric cipher algorithm, such as 3DES.</p>
<p>An unencrypted PEM file might look something like this:</p>
<p>&nbsp;&nbsp;&nbsp; &#8212;&#8211;BEGIN CERTIFICATE&#8212;&#8211;<br />&nbsp;&nbsp;&nbsp; MB4CGQDUoLoCULb9LsYm5+/WN992xxbiLQlEuIsCAQM=<br />&nbsp;&nbsp;&nbsp; &#8212;&#8211;END CERTIFICATE&#8212;&#8211;</p>
<p>The string beginning with MB4C&#8230; is the Base64-encoded, ASN.1-encoded object.</p>
<p>An encrypted file would have headers describing the type of encryption used, and the initialization vector:</p>
<p>&nbsp;&nbsp;&nbsp; &#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;<br />&nbsp;&nbsp;&nbsp; Proc-Type: 4,ENCRYPTED<br />&nbsp;&nbsp;&nbsp; DEK-Info: DES-EDE3-CBC,C814158661DC1449<br />&nbsp;&nbsp;&nbsp; AFAZFbnQNrGjZJ/ZemdVSoZa3HWujxZuvBHzHNoesxeyqqidFvnydA==<br />&nbsp;&nbsp;&nbsp; &#8212;&#8211;END RSA PRIVATE KEY&#8212;&#8211;</p>
<p>The two headers Proc-Type and DEK-Info declare the type of encryption, and the string starting with AFAZ&#8230; is the Base64-encoded, encrypted, ASN.1-encoded object.</p>
<p>As web browsers make use of Java applications, they import/export certificates in pkcs12 file format, i.e. public and private keys are packed in one single file using the PKCS#12 algorithm. Other applications require the pem format with unpacked public and private keys, thus the user must remember the appropriate file format for each application and must perform format conversions as appropriate.</p>
<p>The following tables report a summary of formats used for INFN-Grid applications and two simple scripts with format conversion commands.</p>
<p>INFN-Grid Certificates Format Summary<br />Certificate Type &nbsp;&nbsp;&nbsp; Certificate Format<br />CA Authority Certificate &nbsp;&nbsp;&nbsp; DER<br />Personal Certificate from CA &nbsp;&nbsp;&nbsp; PKCS12<br />Grid Access Certificate &nbsp;&nbsp;&nbsp; PEM</p>
<p>=========================<br />CONVERT pkcs12 to pem<br />=========================<br />#!/bin/sh<br />echo &#8220;copy your cert to cert.p12 &#8211; then run this script&#8221;<br />openssl pkcs12 -clcerts -nokeys -in cert.p12 -out usercert.pem<br />openssl pkcs12 -nocerts -in cert.p12 -out userkey.pem</p>
<p>=========================<br />CONVERT pem to pkcs12<br />=========================<br />#!/bin/sh<br />echo &#8220;Verify that you are using the correct certificate pair (key/cert)&#8221;<br />openssl pkcs12 -export -out one.identity.neteller.com.p12 -inkey ./one.identity.neteller.com.key -in ./one.identity.neteller.com.cert </p>
<p>** NOTE: specify the -in and -inkey parameters as PEM format files&#8230; </p>
<p>If your running JRockit, you might also be interested in how to <a href="http://publib.boulder.ibm.com/infocenter/iwphelp/v2r5m1/index.jsp?topic=/com.ibm.wcs.ic.doc_2.5.1/infocenter/i_sec_t_updateverisignrootcert.html">update Verisign CA root certificates</a>. </p>
<p>This might be required if you start seeing errors such as this:<br />javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=5d37ff70-843b-8313-8968-e114e42e13b9" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=OpenSSL+Certificate+Formats+%2F+Conversion+http%3A%2F%2Ftinyurl.com%2F472ym2m" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=OpenSSL+Certificate+Formats+%2F+Conversion+http%3A%2F%2Ftinyurl.com%2F472ym2m" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/131/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a default &#8216;usage&#8217; target for your ANT project builds</title>
		<link>http://www.codedrop.ca/blog/archives/121</link>
		<comments>http://www.codedrop.ca/blog/archives/121#comments</comments>
		<pubDate>Fri, 14 Aug 2009 17:14:13 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[Build Automation]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/121</guid>
		<description><![CDATA[I keep coming across instances of ant build files where developers have hard coded a usage target that outputs target actions.&#160; This is not required and should be avoided as it is often not maintained.&#160; Instead, properly maintain the description attribute of each target and use a default target as below:&#160;&#160; &#60;project name="foo" basedir="." default="usage"&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I keep coming across instances of ant build files where developers have hard coded a usage target that outputs target actions.&nbsp; This is not required and should be avoided as it is often not maintained.&nbsp; Instead, properly maintain the description attribute of each target and use a default target as below:&nbsp;&nbsp;<br />
<br/><br/></p>
<pre>
&lt;project name="foo" basedir="." default="usage"&gt;

...

&lt;target name="usage"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;java classname="org.apache.tools.ant.Main"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;arg value="-projecthelp"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;classpath&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/ant.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/ant-launcher.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pathelement location="${lib.dir}/ant/xerces_2.8.0.jar"/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/classpath&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/java&gt;
&nbsp;&nbsp;&nbsp; &lt;/target&gt;

...

&lt;/project&gt;
</pre>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=79307383-1e97-863a-86f6-4643f16acad8" /></div>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=Create+a+default+%E2%80%98usage%E2%80%99+target+for+your+ANT+project+builds+http%3A%2F%2Ftinyurl.com%2F3dtse5w" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Create+a+default+%E2%80%98usage%E2%80%99+target+for+your+ANT+project+builds+http%3A%2F%2Ftinyurl.com%2F3dtse5w" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/121/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PERL script for identifying installed modules.</title>
		<link>http://www.codedrop.ca/blog/archives/113</link>
		<comments>http://www.codedrop.ca/blog/archives/113#comments</comments>
		<pubDate>Fri, 31 Jul 2009 15:30:45 +0000</pubDate>
		<dc:creator>groll</dc:creator>
				<category><![CDATA[PERL]]></category>

		<guid isPermaLink="false">http://www.codedrop.ca/blog/archives/113</guid>
		<description><![CDATA[Trying to identify all modules installed on your local server?&#8230; try this command:Note: First time you run you might have to configure CPAN&#8230; for the most part defaults are good but pick a good local mirror. perl -MCPAN -e 'print CPAN::Shell-&#62;r ' Package namespace installed latest in CPAN file Archive::Tar 1.30 1.52 K/KA/KANE/Archive-Tar-1.52.tar.gz Attribute::Handlers 0.78_01 [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to identify all modules installed on your local server?&#8230; try this command:<br />Note: First time you run you might have to configure CPAN&#8230; for the most part defaults are good but pick a good local mirror.
<pre>
perl -MCPAN -e 'print CPAN::Shell-&gt;r '

Package namespace    installed    latest  in CPAN file
Archive::Tar              1.30      1.52  K/KA/KANE/Archive-Tar-1.52.tar.gz
Attribute::Handlers    0.78_01      0.85  S/SM/SMUELLER/Attribute-Handlers-0.85.tar.gz
AutoLoader                5.60      5.68  S/SM/SMUELLER/AutoLoader-5.68.tar.gz
B                         1.02      1.19  N/NW/NWCLARK/perl-5.8.9.tar.gz
B::Debug                  1.01      1.11  R/RU/RURBAN/B-Debug-1.11.tar.gz
</pre>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/home/?status=PERL+script+for+identifying+installed+modules.+http%3A%2F%2Ftinyurl.com%2F3b4gvm5" title="Post to Twitter"><img class="nothumb" src="http://www.codedrop.ca/blog/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=PERL+script+for+identifying+installed+modules.+http%3A%2F%2Ftinyurl.com%2F3b4gvm5" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.codedrop.ca/blog/archives/113/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

