anon.crypto.tinytls
Class TinyTLSServerSocket

java.lang.Object
  extended by java.net.Socket
      extended by anon.crypto.tinytls.TinyTLSServerSocket

public class TinyTLSServerSocket
extends java.net.Socket

Author:
stefan TinyTLS

Nested Class Summary
(package private)  class TinyTLSServerSocket.TLSInputStream
           
(package private)  class TinyTLSServerSocket.TLSOutputStream
           
 
Field Summary
private  byte[] m_clientrandom
           
private  JAPCertificate m_DSSCertificate
           
private  MyDSAPrivateKey m_DSSKey
           
private  boolean m_encrypt
           
private  boolean m_handshakecompleted
           
private  byte[] m_handshakemessages
           
private  TinyTLSServerSocket.TLSInputStream m_istream
           
private  TinyTLSServerSocket.TLSOutputStream m_ostream
           
private  IMyPrivateKey m_privatekey
           
private  JAPCertificate m_RSACertificate
           
private  MyRSAPrivateKey m_RSAKey
           
private  CipherSuite m_selectedciphersuite
           
private  JAPCertificate m_servercertificate
           
private  byte[] m_serverrandom
           
private  java.net.Socket m_Socket
           
private  java.util.Vector m_supportedciphersuites
           
static byte[] PROTOCOLVERSION
          SSL VERSION : 3.1 for TLS
private static int PROTOCOLVERSION_SHORT
           
 
Constructor Summary
TinyTLSServerSocket(java.net.Socket socket)
          TinyTLS creates a TLS Connection to a server
 
Method Summary
 void addCipherSuite(CipherSuite cs)
          add a ciphersuites to TinyTLS
 void close()
           
 java.io.InputStream getInputStream()
           
 java.io.OutputStream getOutputStream()
           
 void setDSSParameters(JAPCertificate cert, MyDSAPrivateKey key)
          set the dss parameters if dss key exchange is used
 void setRSAParameters(JAPCertificate cert, MyRSAPrivateKey key)
          set the rsa parameters if rsa key exchange is used
 void setSoTimeout(int ms)
           
 void startHandshake()
          start the handshake
 
Methods inherited from class java.net.Socket
bind, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOLVERSION

public static byte[] PROTOCOLVERSION
SSL VERSION : 3.1 for TLS


PROTOCOLVERSION_SHORT

private static int PROTOCOLVERSION_SHORT

m_supportedciphersuites

private java.util.Vector m_supportedciphersuites

m_selectedciphersuite

private CipherSuite m_selectedciphersuite

m_Socket

private java.net.Socket m_Socket

m_istream

private TinyTLSServerSocket.TLSInputStream m_istream

m_ostream

private TinyTLSServerSocket.TLSOutputStream m_ostream

m_handshakecompleted

private boolean m_handshakecompleted

m_clientrandom

private byte[] m_clientrandom

m_serverrandom

private byte[] m_serverrandom

m_servercertificate

private JAPCertificate m_servercertificate

m_privatekey

private IMyPrivateKey m_privatekey

m_DSSKey

private MyDSAPrivateKey m_DSSKey

m_RSAKey

private MyRSAPrivateKey m_RSAKey

m_DSSCertificate

private JAPCertificate m_DSSCertificate

m_RSACertificate

private JAPCertificate m_RSACertificate

m_handshakemessages

private byte[] m_handshakemessages

m_encrypt

private boolean m_encrypt
Constructor Detail

TinyTLSServerSocket

public TinyTLSServerSocket(java.net.Socket socket)
                    throws java.io.IOException
TinyTLS creates a TLS Connection to a server

Parameters:
addr - Server Address
port - Server's TLS Port
Throws:
java.io.IOException
Method Detail

addCipherSuite

public void addCipherSuite(CipherSuite cs)
add a ciphersuites to TinyTLS

Parameters:
cs - ciphersuite you want to add

startHandshake

public void startHandshake()
                    throws java.io.IOException
start the handshake

Throws:
java.io.IOException
CertificateException
java.lang.Exception

setDSSParameters

public void setDSSParameters(JAPCertificate cert,
                             MyDSAPrivateKey key)
set the dss parameters if dss key exchange is used

Parameters:
cert - certificate
key - dsa private key

setRSAParameters

public void setRSAParameters(JAPCertificate cert,
                             MyRSAPrivateKey key)
set the rsa parameters if rsa key exchange is used

Parameters:
cert - certificate
key - rsa private key

getInputStream

public java.io.InputStream getInputStream()
Overrides:
getInputStream in class java.net.Socket

getOutputStream

public java.io.OutputStream getOutputStream()
Overrides:
getOutputStream in class java.net.Socket

close

public void close()
           throws java.io.IOException
Overrides:
close in class java.net.Socket
Throws:
java.io.IOException

setSoTimeout

public void setSoTimeout(int ms)
                  throws java.net.SocketException
Overrides:
setSoTimeout in class java.net.Socket
Throws:
java.net.SocketException