Java Globus API: Class SSLClientConnection

org.globus.security
Class SSLClientConnection

java.lang.Object
  |
  +--org.globus.security.SSLClientConnection

public class SSLClientConnection
extends java.lang.Object

Represents an SSL connection from a client to a SSL server.

USING THE SSLClientConnection Class

The intention of the SSLClientConnection class is to simplilfy a connection to an SSL server. Its methods include:
  1. establishing which servers are authorized
  2. connecting to an SSL server
  3. performing delegation
  4. getting input and output streams
  5. disconnecting from the SSL server
The first step in using this class is to instantiate it, either as:
SSLClientConnection conn = new SSLClientConnection();
To connect, pass the hostname and port of the SSL server you want to connect to:
conn.connect("ssl.server.host", );
After connection it is possible to do delegation by calling the function doDelegation(bool, bool):
conn.doDelegation(, );
To close the SSLConnection call:
conn.disconnect();


Constructor Summary
SSLClientConnection()
           
SSLClientConnection(GlobusProxy inProxy)
           
 
Method Summary
 java.net.Socket connect(java.net.Socket simpleSocket)
          Creates a new SSL socket out of an ordinary socket, causing the SSL handshake to take place, and creating a new, secure connection out of the old insecure socket.
 java.net.Socket connect(java.lang.String host, int port)
          Initiates a connection to the server residing at the specified host and port, causing a hello to be sent to the server, and the SSL handshake process to begin.
protected  iaik.security.ssl.SSLClientContext createContext(GlobusProxy proxy)
           
static void destroyContext(GlobusProxy proxy)
           
 boolean disconnect()
          Closes the established connection and disconnects from the server
 void doDelegation(boolean doDel, boolean doLim)
          Called after connecting to a gatekeeper, sends a character which determines whether delegation is to be performed or not.
static void enableDebug(java.net.Socket socket)
           
 void enableEncryption(boolean encryption)
           
 java.security.cert.X509Certificate getCertificate()
           
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
           
 void setAuthorization(Authorization auth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLClientConnection

public SSLClientConnection()
                    throws GlobusProxyException
Throws:
GlobusProxyException - if there are any problems with the loading the proxy file

SSLClientConnection

public SSLClientConnection(GlobusProxy inProxy)
Method Detail

createContext

protected iaik.security.ssl.SSLClientContext createContext(GlobusProxy proxy)

enableEncryption

public void enableEncryption(boolean encryption)

destroyContext

public static void destroyContext(GlobusProxy proxy)

setAuthorization

public void setAuthorization(Authorization auth)

connect

public java.net.Socket connect(java.net.Socket simpleSocket)
                        throws java.io.IOException
Creates a new SSL socket out of an ordinary socket, causing the SSL handshake to take place, and creating a new, secure connection out of the old insecure socket.
Parameters:
simpleSocket - the non-SSL socket

connect

public java.net.Socket connect(java.lang.String host,
                               int port)
                        throws java.io.IOException
Initiates a connection to the server residing at the specified host and port, causing a hello to be sent to the server, and the SSL handshake process to begin.
Parameters:
host - the host where the SSL server to connect to is
port - the port on the specified host where the SSL server is

getCertificate

public java.security.cert.X509Certificate getCertificate()

doDelegation

public void doDelegation(boolean doDel,
                         boolean doLim)
                  throws java.io.IOException
Called after connecting to a gatekeeper, sends a character which determines whether delegation is to be performed or not. If delegation is to be performed, it then reads in the cert request sent by the gatekeeper, signs and returns it, and returns true if everything is successful.
Parameters:
doDel - if true, send a 'D' to activate delegation, otherwise send 'N'
doLim - if true, perform limited delegation (this param ignored if do doDel is false
Throws:
IOException - if delegation process failed.

disconnect

public boolean disconnect()
Closes the established connection and disconnects from the server
Returns:
boolean returns true if connection was closed successfully, otherwise returns false if an exception was thrown.

getInputStream

public java.io.InputStream getInputStream()
Returns:
InputStream the input stream which can be used to read from the server the connection is to

getOutputStream

public java.io.OutputStream getOutputStream()
Returns:
OutputStream the output stream which can be used to write to the server the connection is to

enableDebug

public static void enableDebug(java.net.Socket socket)