Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SSLHandShakeException

 
Ashwin B Philar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!!
This is the first time I am trying to access an HTTPS site using Java.
I installed the latest java sdk1.4.0_01 on my machine.
I downloaded the URLReader.java file from Sun's site and tried to run it, but I am getting the following error:

Exception in thread "main" javax.net.ssl.SSLHandshakeException: Couldn't find trusted certificate
This is the code:
import java.net.*;
import java.io.*;
public class URLReader
{
public static void main(String[] args) throws Exception
{
System.setProperty("https.proxyHost","webproxy");
System.setProperty("https.proxyPort","8080");
URL verisign = new URL("https://www.verisign.com/");
BufferedReader in = new BufferedReader(new
InputStreamReader(verisign.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
Please let me know why I am getting this error.
Thanks
Ashwin
 
raman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
when you try to access a site using ssl, the authenticity of the server's certificate is determined on following three parameters:
1. whether the certificate was issued from a trusted certifying authrority.
2. whether the date specified in the certificate valid.
3. the name on the certificate is same as the name of the website you are trying to view.
if you are accessing verisign, the first and third options would be valid. the only thing left is the date. check whether your system date is correct or not.
or try to view the page in a browser, if you get a warning, try to figure out where the problem was.
do let me know if you solved it?
bye
raman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic