Hello everybody!
I have installed JDK 1.4 and wrote the following Java code to open HTTPS
connections:
URL verisign = new URL("https://jcewww.iaik.at/");
HttpsURLConnection con =
(HttpsURLConnection)verisign.openConnection();
InputStream ins = con.getInputStream();
InputStreamReader isr=new InputStreamReader(ins);
BufferedReader in =new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
At statement "InputStream ins = con.getInputStream();" I receive this
exception:
javax.net.ssl.SSLHandshakeException: Could not find trusted certificate
In attach you find the snapshot with the detailed description of the error.
If as URL I insert www.verisign.com all works correctly. I tried to set a my
HostNameVerifier class for the HttpsURLConnection object. It is something
like this:
class MyVerif implements HostnameVerifier
{
public boolean verify(String hostname, SSLSession session)
{
return true;
}
}
The verify process returns always "true" in any case....I thought that this
trick let me
to avoid this type of error but I was wrong, in fact inserting the URL
"https://jcewww.iaik.at/"
I receive the same error :-(
I tried to install IAIK provider and iSaSiLK APIs and all works fine with
url "https://jcewww.iaik.at/"
too!! How come? It seems that IAIK provider doesn't check if there is a
trusted certificate available....
How can I avoid the "javax.net.ssl.SSLHandshakeException" using only JDK
1.4??
Thanks a lot everybody in advance!
Luca
Attachment:
error.jpg
Description: JPEG image