• Post Reply Bookmark Topic Watch Topic
  • New Topic

Communicating with HTTPS server with Client Authentication  RSS feed

Shankar Shanmugam
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
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) {
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!