com.kodemuse.security.ssl
Class SSLContext

java.lang.Object
  |
  +--com.kodemuse.security.ssl.LogCapability
        |
        +--com.kodemuse.security.ssl.SSLContext

public class SSLContext
extends LogCapability

Context for SSL communciation. Encapsulates Identity information. There may be a one SSLContext for all the server side connections.

Author:
Harmeet Bedi

Constructor Summary
SSLContext()
          No Paramaters.
SSLContext(java.io.File keyStorePKCS12File, java.lang.String password)
           
SSLContext(java.security.KeyStore keyStore, java.lang.String password)
           
SSLContext(java.security.cert.X509Certificate[] certChain, java.security.interfaces.RSAPrivateKey privateKey)
           
 
Method Summary
(package private)  void cacheClientSession(SessionID sessionID, byte[] masterSecret, CipherSpec spec)
           
(package private)  void cacheServerSession(java.lang.String ipAddr, int port, SessionID sessionID, byte[] masterSecret, CipherSpec spec)
           
(package private)  ResumedSessionEntry getClientSessionEntry(SessionID sessionID)
           
(package private)  CertificateChain getHandshakeCertificateChain()
           
(package private)  java.security.interfaces.RSAPrivateKey getPrivateKey()
           
(package private)  ResumedSessionEntry getServerSessionEntry(java.lang.String ipAddr, int port)
          Called by client side to get server session entry information,
 ConnectionDecorator getSSLClientSocketDecorator(TrustStore store)
           
 ConnectionDecorator getSSLServerSocketDecorator(TrustStore store)
          Converts Socket to Server Side SSL Socket
(package private)  CipherSpec[] getSupportedCipherSpec()
           
(package private)  CipherSpec selectCipherSpec(CipherSpec[] cs)
           
 
Methods inherited from class com.kodemuse.security.ssl.LogCapability
log, protocolLog
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLContext

public SSLContext()
No Paramaters. May be used by anonymous SSL Client.

SSLContext

public SSLContext(java.io.File keyStorePKCS12File,
                  java.lang.String password)
           throws java.lang.Exception
Parameters:
keyStorePKCS12File: - PKCS12 indentity file
password: - password for the PKCS12 identity. PKCS12 is a PBE standard.

SSLContext

public SSLContext(java.security.KeyStore keyStore,
                  java.lang.String password)
           throws java.lang.Exception
Parameters:
keyStore: - KeyStore. Identity for SSL communication.
password: - password for the key store.

SSLContext

public SSLContext(java.security.cert.X509Certificate[] certChain,
                  java.security.interfaces.RSAPrivateKey privateKey)
           throws java.lang.Exception
Parameters:
certChain: - Certificate chain.
privateKey: - private key for the identity.
Method Detail

getSupportedCipherSpec

CipherSpec[] getSupportedCipherSpec()

selectCipherSpec

CipherSpec selectCipherSpec(CipherSpec[] cs)

getHandshakeCertificateChain

CertificateChain getHandshakeCertificateChain()

getPrivateKey

java.security.interfaces.RSAPrivateKey getPrivateKey()

getSSLServerSocketDecorator

public ConnectionDecorator getSSLServerSocketDecorator(TrustStore store)
Converts Socket to Server Side SSL Socket
Parameters:
trustedCerts: - if null, the server side trusts unauthenticated client connections. if not null the server request client certificates. The client certificate is validated against truststore

getSSLClientSocketDecorator

public ConnectionDecorator getSSLClientSocketDecorator(TrustStore store)

getServerSessionEntry

ResumedSessionEntry getServerSessionEntry(java.lang.String ipAddr,
                                          int port)
Called by client side to get server session entry information,
Parameters:
ipAddr - Server IP address

cacheServerSession

void cacheServerSession(java.lang.String ipAddr,
                        int port,
                        SessionID sessionID,
                        byte[] masterSecret,
                        CipherSpec spec)

getClientSessionEntry

ResumedSessionEntry getClientSessionEntry(SessionID sessionID)

cacheClientSession

void cacheClientSession(SessionID sessionID,
                        byte[] masterSecret,
                        CipherSpec spec)