anon.crypto.tinytls
Class TinyTLS.TLSInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by anon.crypto.tinytls.TinyTLS.TLSInputStream
All Implemented Interfaces:
TinyTLS.ITLSConstants, java.io.Closeable
Enclosing class:
TinyTLS

 class TinyTLS.TLSInputStream
extends java.io.InputStream
implements TinyTLS.ITLSConstants

Author:
stefan TLSInputStream

Field Summary
private  int m_aktPendLen
           
private  int m_aktPendOffset
           
private  TLSPlaintextRecord m_aktTLSRecord
           
private  int m_ReadRecordState
           
private  java.io.DataInputStream m_stream
           
 
Fields inherited from interface anon.crypto.tinytls.TinyTLS.ITLSConstants
STATE_LENGTH, STATE_PAYLOAD, STATE_START, STATE_VERSION
 
Constructor Summary
TinyTLS.TLSInputStream(java.io.InputStream istream)
          Constructor
 
Method Summary
 int available()
           
private  void gotCertificate(TLSHandshakeRecord msg)
          process server certificate
private  void gotCertificateRequest(TLSHandshakeRecord msg)
          handle certificate request
private  void gotServerHello(TLSHandshakeRecord msg)
          process server hello
private  void gotServerHelloDone()
          handle server hello done message
private  void gotServerKeyExchange(TLSHandshakeRecord msg)
          process server key exchange message
private  void handleAlert()
          handle alert message
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
private  void readRecord()
          Reads one record if we need more data...
protected  void readServerFinished()
          wait for server finished message
protected  void readServerHandshakes()
          read the server handshakes and handle alerts
 
Methods inherited from class java.io.InputStream
close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stream

private java.io.DataInputStream m_stream

m_aktPendOffset

private int m_aktPendOffset

m_aktPendLen

private int m_aktPendLen

m_aktTLSRecord

private TLSPlaintextRecord m_aktTLSRecord

m_ReadRecordState

private int m_ReadRecordState
Constructor Detail

TinyTLS.TLSInputStream

public TinyTLS.TLSInputStream(java.io.InputStream istream)
Constructor

Parameters:
istream - inputstream
Method Detail

readRecord

private void readRecord()
                 throws java.io.IOException
Reads one record if we need more data... Block until data is available...

Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

available

public int available()
Overrides:
available in class java.io.InputStream

gotServerHello

private void gotServerHello(TLSHandshakeRecord msg)
                     throws java.io.IOException
process server hello

Parameters:
bytes - server hello message
Throws:
java.io.IOException

gotCertificate

private void gotCertificate(TLSHandshakeRecord msg)
                     throws java.io.IOException
process server certificate

Parameters:
bytes - server certificate message
Throws:
java.io.IOException

gotServerKeyExchange

private void gotServerKeyExchange(TLSHandshakeRecord msg)
                           throws java.io.IOException
process server key exchange message

Parameters:
bytes - server key exchange message
Throws:
java.io.IOException
java.lang.Exception

gotCertificateRequest

private void gotCertificateRequest(TLSHandshakeRecord msg)
handle certificate request

Parameters:
bytes - certificate request message

gotServerHelloDone

private void gotServerHelloDone()
handle server hello done message

Parameters:
bytes - server hello done message

handleAlert

private void handleAlert()
                  throws java.io.IOException
handle alert message

Throws:
java.io.IOException

readServerHandshakes

protected void readServerHandshakes()
                             throws java.io.IOException
read the server handshakes and handle alerts

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

readServerFinished

protected void readServerFinished()
                           throws java.io.IOException
wait for server finished message

Throws:
java.io.IOException