Java SSL

Posted on 2005-05-01
Last Modified: 2012-06-22
I am trying to use to connect to a secure server, but i get the following error peer not authenticated

I know this is happening because the server has a self signed certificate
how do i add a host/certificate to a "trusted list" so that this exception isnt thrown?

Question by:sniop1
    1 Comment
    LVL 15

    Accepted Solution

    This article explain how to add your server (self signed certificate) to your client trusted list.
    1. Export the self-signed certificate.
    keytool -export -alias "alias name" -keystore "keyFile" -rfc -file "alias name".cer

    2. Import the certificate into a new/your client truststore.
    keytool -import -alias "alias name"cert -file "alias name".cer -keystore truststore

    3. add the following codes to your client program.
    System.setProperty("", "truststore");
    System.setProperty("", "trustword");

    You can see this link for more details:

    Another solution is to use one of the anonymous cipher suite which enable secure channel without authenticating the sides

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    countClumps  challenge 10 66
    Basics of Drool Rule Engine with few samples 2 31
    factorial example challenge 10 44
    pairstar challenge 2 26
    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now