Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JSSE 1.0.1 and accessing Servlets


  • From: nparis@xxxxxxxxxxxxxxxx (Nathan Paris)
  • Subject: JSSE 1.0.1 and accessing Servlets
  • Date: Thu, 30 Mar 2000 17:01:57 -0700

Gurus,

I have been trying to use the JSSE package to try and access servlets
through SSL.  I am able so access simple HTML pages through SSL, but I
recieve null when I read  from a servlet.  Any sugestions welcome.  

Thanks in advance.

Here is part of the code being used:
  
public void doHTTPSProtocol(String webServer, String item) throws
IOException {
    // Register the SSL cyptographic provider w/ Java runtime system
    java.security.Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());
    // Add SSL protocol
 
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");

    SSLSocketFactory factory =
(SSLSocketFactory)SSLSocketFactory.getDefault();
    SSLSocket socket = (SSLSocket)factory.createSocket(webServer, 443);

    // send http request
    // before any application data gets sent or received, ssl socket will do
ssl handshaking first to set up
    // the security associates
    PrintWriter out = new PrintWriter( new BufferedWriter( new
OutputStreamWriter(socket.getOutputStream())));

    // item is the servlet i.e /servlet/.......
    out.println("GET " + item);
    out.println();
    out.flush();

    // read response
    BufferedReader in = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null)
      System.out.println(inputLine);
    in.close();
    socket.close();
  }


---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx