For Programmers: Free Programming Magazines  


Home > Archive > Java Security > March 2004 > Please help: SSL: URLReader: Works sometimes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Please help: SSL: URLReader: Works sometimes
Xavier

2004-03-19, 8:55 pm

The following code works when ran as:
java -Dhttps.proxyHost=myproxyHost.com -Dhttps.proxyPort=8080
URLReader

public class URLReader {
public static void main(String[] args) throws Exception {
String authentication = "Basic " + new
sun.misc.BASE64Encoder().encode("myid:mypassword".getBytes());

URL verisign = new URL("https://www.thawte.com");
HttpURLConnection con = (HttpURLConnection)
verisign.openConnection();
con.setRequestProperty("Proxy-Authorization", authentication);

BufferedReader in = new BufferedReader(
new InputStreamReader(
con.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);

in.close();
}
}


However, when I change the host to https://www.verisign.com, it gives
the following exception:
Exception in thread "main" javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No trusted certificate
found

When I turn the debug on I see the following:
keyStore is :
keyStore type is : jks
init keystore
init keymanager of type SunX509
trustStore is: D:\Sun\AppServer\jdk\jre\lib\security\ca
certs
trustStore type is : jks
init truststore

How can I add a verisign certificate to the key store that will make
the program work?

Thank You..
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com