dcsimg
sun.security.validator.ValidatorException: No trusted certificate found
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, February 21, 2004 08:40 AM

hello I am trying to do a HTTP POST to an https-site, but get the exception as mentioned in the subject. URL url = new java.net.URL("https://somesecuresite.com"); HttpURLConnection connection = (java.net.HttpURLConnection)url.openConnection(); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); java.io.OutputStream os = connection.getOutputStream(); //gives sun.security.valida   More>>

hello


I am trying to do a HTTP POST to an https-site, but get the exception as mentioned in the subject.



URL url = new java.net.URL("https://somesecuresite.com");


HttpURLConnection connection = (java.net.HttpURLConnection)url.openConnection();


connection.setDoInput(true);


connection.setRequestMethod("POST");


connection.setDoOutput(true);


connection.setUseCaches(false);


connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");


java.io.OutputStream os = connection.getOutputStream(); //gives sun.security.validator.ValidatorException


PrintWriter out = new PrintWriter(os);


out.println("hello world");


out.close();




Does anybody have a clue what is going wrong? I am using java version 1.4.2_03-b02. The connection is not supposed to use any certificate. I have also tried to upgrade the Verisign Root Certifiactes as described here . Since I am using 1.4.2_03, this should not be necessary, however...


I really appreciate anything that can bring me closer to the solution


cheers,
pj

   <<Less

Re: sun.security.validator.ValidatorException: No trusted certificate found

Posted By:   Anonymous  
Posted On:   Tuesday, March 2, 2004 01:50 AM

Re: sun.security.validator.ValidatorException: No trusted certificate found

Posted By:   Jaime_Garcia  
Posted On:   Friday, February 27, 2004 11:54 AM

You have to set this properties:



System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

System.setProperty("javax.net.ssl.trustStore","C:/client.keystore");



First one is to use ssl (https).



You need a kestore file containing the certificate of the server. I used this utility to create one:



http://homepage.ntlworld.com/wayne_grant/starting.html



And I accesed the URL from a browser to download the certificate and save it in X.509 format. Then, with the utility just add the certificate.


Hope this helps.

Re: sun.security.validator.ValidatorException: No trusted certificate found

Posted By:   Laxman_Subramanian  
Posted On:   Monday, February 23, 2004 09:35 AM

USE JSSE to connect to a HTTPS site. You are connecting to a SSL enabled website.
About | Sitemap | Contact