dcsimg
networking
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mohan_anand
Posted On:   Thursday, May 31, 2001 01:43 PM

Hi, I am having a standalone java program which is resides on a application server, which is not connected to internet and behind a firewall(No DNS). I am using JSSE1.0.2 to access a particular site which is secured. I am getting the following error when I run the program. HTTPS hostname wrong: should be , but cert says When I give the name, it throws unknown host exception as it is not in internet. Can you tell me what should be done to make the program work. Below is the sample of my application. import java.net.*; import java.io.*; import java.security.*; import javax.net.*; import java.util.*; import com.sun.net.ssl.*; public c   More>>

Hi,
I am having a standalone java program which is resides on a application server, which is not connected to internet and behind a firewall(No DNS). I am using JSSE1.0.2 to access a particular site which is secured. I am getting the following error when I run the program.

HTTPS hostname wrong: should be , but cert
says

When I give the name, it throws unknown host exception as it is not in internet.

Can you tell me what should be done to make the program work.

Below is the sample of my application.
import java.net.*;
import java.io.*;
import java.security.*;
import javax.net.*;
import java.util.*;
import com.sun.net.ssl.*;

public class URLReader {

public static void main(String[] args) throws Exception {
System.getProperties().put("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
System.getProperties().put Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

URL verisign = new URL("https://xxx.xxx.xxx.xxx");
verisign.getHost();
BufferedReader in = new BufferedReader(
new InputStreamReader(
verisign.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();

}

}

Thanks,

Mohan

   <<Less

Re: networking

Posted By:   Sebastien_Spas  
Posted On:   Friday, June 1, 2001 10:44 AM

The problem you meet is normal since https is specified to work this way.

What you should do is develop your own com.sun.net.ssl.HostnameVerifier class, which always says ok,
and develop your own java.net.URLStreamHandler which gives to the com.sun.net.ssl.httpsurlconnection the HostnameVerifier you developped.

regards.
About | Sitemap | Contact