| 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..
|