Ropardo Sowftware development company

Experience software development with ROPARDO S.R.L.

RSS Feed
RSS Feed
  • Home
  • About ROPARDO S.R.L
  • Our websites

Certificate Validation in an HTTPS Connection

By default, accessing an HTTPS URL using the URL class results in an exception if the server’s certificate chain cannot be validated has not previously been installed in the trust store.

Working with: Eclipse as platform, JAVA for the programming language

Purpose: certificate yourself to a webservice so that you can perform operations and access his methods. This tutorial will only step you through the steps of certificating.

Steps to follow:
1. have the necessary certificate
2. install the keytool plugin
3. Java code to use

  1. If you don’t already have the certificate and you need to export it, remember to select the “Base-64 encoded x.509″ option on the export options.

  2. Install the “keytool” plugin in Eclipse. Use this: http://keytool.sourceforge.net/update/ This keytool stores a multitude of certificates. You can import a new certificate in hisĀ  “store”. After you install the keytool, restart Eclipe. After that you will see in the top Eclipse menu another option “Keytool”. Click it and choose “Open keystore”. A new window will pop up asking you some information that you need to complete.

Meaning(Figure 1):

    - Type: choose JKS

    - Filename: the path to the java cacerts file(C:\Program Files\Java\jre6\lib\security\cacerts)

    - Password: changeit(it by default)
    Figure 1:

    Open Keystore


    After this, a “store” of already imported certificates will be open, at your disposal :D , but for this operation all you want to do is import your certificate into it.

    To do that right click on the name of the store and choose: “Import certificate”, like in figure 2.

    Figure 2:


    Import Certificate



    After you click the “Import certificate” this window will pop out :


    Certificate



    Keystore: path to the cacerts(as above)

    Filename : actual path for the certificate you want to import.

    Alias: give it a name as an identifier: eg: Xcertificate

    Just click “Finish” button.

    3. Now I java code, before everything you need to “tell” the program about the certificate you imported with keytool. These are the 2 lines of code:

    System.setProperty(PropsUtil.keyCert, PropsUtil.valueCertPath);

    System.setProperty(PropsUtil.trustPassKey, PropsUtil.trustPassValue);

    Where:

    keyCert = “javax.net.ssl.trustStore”;
    valueCertPath = “C:/Program Files/Java/jre6/lib/security/cacerts”;
    trustPassKey = “javax.net.ssl.trustStorePassword”;
    trustPassValue = “changeit”;

    And that’s about it.

    Help from Ciprian’s Radu document “Working with iManagement from Eclipse”.


  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Get Shareaholic
Tags: certification Eclipse Java keytool webservices

 Posted in: Java
November 6, 2009 | Gabriela Radu | One Comment

One Response

  • Ciprian Radu
    November 9, 2009
    1

    Thanks for writing something about the keytool plugin. I think this s a nice plugin, which allows any Eclipse user to work with Java keystores easier. Of course, you can always manage a Java keystore using the command line tool. Besides official documentation (like http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html), I think that this link is a handy tutorial: http://www.mobilefish.com/tutorials/java/java_quickguide_keytool.html
    If you don’t like to keep in mind how to use the keytool from the command line (I don’t), than the keytool plugin is something nice to consider.

Leave a Reply

 


  • « Previous post
  • Next post »
  • Recent Posts

    • Installing PyGraphviz on Windows
    • Convert python object to XML representation
    • Liferay Portlet Development
    • Norway Road Show 2011 private meeting invitation
    • Oracle OpenWorld 2011
  • Ropardo is Hiring

  • Subscribe

    • Add to Google Reader or Homepage Add to netvibes TopOfBlogs
  • Recent Comments

    • Rajkumar Pomaji on Bluetooth PC Remote Control
    • Stelian Morariu on GWT 2.1 – Uploading a file using the RPC mechanism
    • Sergio on GWT 2.1 – Uploading a file using the RPC mechanism
    • Artem on Liferay: Deployment will start in a few seconds… and how to realy start
    • rkd80 on GWT 2.1 – Uploading a file using the RPC mechanism
  • Archives

    • November 2011 (1)
    • September 2011 (4)
    • July 2011 (3)
    • June 2011 (2)
    • May 2011 (4)
    • April 2011 (4)
    • March 2011 (3)
    • February 2011 (2)
    • January 2011 (2)
    • December 2010 (1)
    • November 2010 (4)
    • October 2010 (4)
    • August 2010 (3)
    • July 2010 (3)
    • June 2010 (6)
    • May 2010 (8)
    • April 2010 (7)
    • March 2010 (9)
    • February 2010 (6)
    • January 2010 (5)
    • December 2009 (7)
    • November 2009 (9)
    • October 2009 (10)
    • September 2009 (14)
    • August 2009 (10)
    • July 2009 (1)
    • June 2009 (1)
    • May 2009 (1)
    • April 2009 (1)
    • March 2009 (1)
    • October 2008 (3)
    • October 2007 (3)
    • July 2007 (4)
    • June 2007 (1)
    • May 2007 (3)
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Categories

    • News (15)
    • Ropardo Team (8)
    • Ropardo Products (6)
      • File Tracking Client (4)
      • iManagement (2)
    • Software Development (83)
      • Microsoft.NET (22)
      • Java (40)
      • Oracle (8)
      • Power Builder (3)
      • Liferay (5)
      • Lotus Notes (9)
      • xWiki (4)
    • System Adminstration (13)
      • Linux (10)
      • Windows (3)
    • Programming (1)
    • Uncategorized (3)
    • Databases (10)
      • MSSQL (5)
      • PostgreeSQL (3)
    • Microsoft.NET (1)
    • Web Development (28)
      • ASP/ASPX (3)
      • Content Management Systems (1)
      • HTML/CSS (5)
      • Javascrip/AJAX (8)
      • PHP (7)
    • Oracle E Business Suite (6)
  • Tags

    .NET ajax blog C# certification client CMS control css database Debugging django Domino Eclipse extension file tracking filter fun gentoo google Hibernate how to html image iManagement import Java javascript jQuery liferay Linux Lotus Notes lotus script Oracle Oracle BI Publisher 11g PHP portal PostgreSQL powerbuilder Python SQL Telerik velocity xml Xwiki

© 2010 ROPARDO s.r.l..

Powered by WordPress. Styled by Ropardo