This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes  Communicating with  HTTPS server with Client Authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark " Communicating with  HTTPS server with Client Authentication" Watch " Communicating with  HTTPS server with Client Authentication" New topic
Author

Communicating with HTTPS server with Client Authentication

Shankar Shanmugam
Greenhorn

Joined: Sep 12, 2001
Posts: 23
Hi,
I need to do a Client Authentication with the server running on HTTPS (from a Java code).
First, I thought of connecting and reading to a HTTPS server and try Client Authentication later.
I failed in the first step itself. I could not connect to https://mail.yahoo.com . It throws an the following error..
NOTE: I could get the connection and read the content of the server running my company's internal network using the below code.
Please let me know if you guys have any idead about this one and also for doing the Client Authentication
java.util.NoSuchElementException
at java.util.StringTokenizer.nextToken(StringTokenizer.java:232)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:768)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:562)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(DashoA6275)
at Test.main(Test.java:19)
Exception in thread "main"

import java.io.*;
import java.net.*;
import javax.net.ssl.*;
public class Test {
public static void main(String args[]) throws Exception {
System.setProperty("https.proxyHost", "ghqproxy1.is.ge.com");
System.setProperty("https.proxyPort", "80");

URL url = new URL("https://www.entrust.com/");
URLConnection conn = url.openConnection();
HttpsURLConnection urlConn = (HttpsURLConnection) conn;
BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
String str;
while( (str=in.readLine()) != null) {
System.out.println(str);
}
}
}


Shankar Shanmugam<br />Sun Certified Programmer for Java 2 Platform<br />Sun Certified Developer for Java 2 Platform<br />Email: shankar.s@vsnl.net<br /> "Walking on water and building IT Architecture from <br /> specification are easy if and only if both are frozen"<br />-----------------------------------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communicating with HTTPS server with Client Authentication
 
Similar Threads
Https url connection ArrayIndeoutofBounds Exception java
ArrayIndexOutOfBoundsException
HttpsURLConnection - Problem in SSL Handshaking
Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Requ
Unable to tunnel through proxy. Proxy returns "HTTP/1.0 407 Proxy Authentication Requ