anon.crypto.tinytls
Class TinyTLS.TLSOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by anon.crypto.tinytls.TinyTLS.TLSOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
TinyTLS

 class TinyTLS.TLSOutputStream
extends java.io.OutputStream

Author:
stefan TLSOutputStream

Field Summary
private  TLSPlaintextRecord m_aktTLSRecord
           
private  java.io.OutputStream m_stream
           
 
Constructor Summary
TinyTLS.TLSOutputStream(java.io.OutputStream ostream)
          Constructor
 
Method Summary
 void close()
           
 void flush()
           
private  void send(int type, byte[] message, int offset, int len)
          send a message to the server
 void sendCertificateVerify()
          send a certificate verify message if a certificate is used
 void sendChangeCipherSpec()
          send a change cipher spec message now all client data will be encrypted
 void sendClientCertificate()
          send a client certificate message
 void sendClientFinished()
          send a client finished message
 void sendClientHello()
          send a client hello message
 void sendClientKeyExchange()
          send a client key exchange message
 void sendCloseNotify()
          send a close notify message to inform the peer that this connection will be closed now message
 void sendHandshake(int type, byte[] message)
          send a handshake message to the server
 void write(byte[] message)
           
 void write(byte[] message, int offset, int len)
           
 void write(int i)
           
 
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.OutputStream m_stream

m_aktTLSRecord

private TLSPlaintextRecord m_aktTLSRecord
Constructor Detail

TinyTLS.TLSOutputStream

public TinyTLS.TLSOutputStream(java.io.OutputStream ostream)
Constructor

Parameters:
ostream - outputstream
Method Detail

write

public void write(byte[] message)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] message,
                  int offset,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(int i)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

send

private void send(int type,
                  byte[] message,
                  int offset,
                  int len)
           throws java.io.IOException
send a message to the server

Parameters:
type - type of the tls message
message - message
Throws:
java.io.IOException

sendHandshake

public void sendHandshake(int type,
                          byte[] message)
                   throws java.io.IOException
send a handshake message to the server

Parameters:
type - handshake type
message - message
Throws:
java.io.IOException

sendClientHello

public void sendClientHello()
                     throws java.io.IOException
send a client hello message

Throws:
java.io.IOException

sendClientCertificate

public void sendClientCertificate()
                           throws java.io.IOException
send a client certificate message

Throws:
java.io.IOException

sendClientKeyExchange

public void sendClientKeyExchange()
                           throws java.io.IOException
send a client key exchange message

Throws:
java.io.IOException

sendCertificateVerify

public void sendCertificateVerify()
                           throws java.io.IOException
send a certificate verify message if a certificate is used

Throws:
java.io.IOException

sendChangeCipherSpec

public void sendChangeCipherSpec()
                          throws java.io.IOException
send a change cipher spec message now all client data will be encrypted

Throws:
java.io.IOException

sendCloseNotify

public void sendCloseNotify()
                     throws java.io.IOException
send a close notify message to inform the peer that this connection will be closed now message

Throws:
java.io.IOException

sendClientFinished

public void sendClientFinished()
                        throws java.io.IOException
send a client finished message

Throws:
java.io.IOException