org.bouncycastle.crypto.tls
Class TlsUtils

java.lang.Object
  extended by org.bouncycastle.crypto.tls.TlsUtils

public class TlsUtils
extends java.lang.Object

Some helper fuctions for MicroTLS.


Constructor Summary
TlsUtils()
           
 
Method Summary
protected static void checkVersion(byte[] readVersion, TlsProtocolHandler handler)
           
protected static void checkVersion(java.io.InputStream is, TlsProtocolHandler handler)
           
private static void hmac_hash(Digest digest, byte[] secret, byte[] seed, byte[] out)
           
protected static void PRF(byte[] secret, byte[] label, byte[] seed, byte[] buf)
           
protected static void readFully(byte[] buf, java.io.InputStream is)
           
protected static int readUint16(java.io.InputStream is)
           
protected static int readUint24(java.io.InputStream is)
           
protected static long readUint32(java.io.InputStream is)
           
protected static short readUint8(java.io.InputStream is)
           
(package private) static byte[] toByteArray(java.lang.String str)
           
protected static void writeUint16(int i, byte[] buf, int offset)
           
protected static void writeUint16(int i, java.io.OutputStream os)
           
protected static void writeUint24(int i, byte[] buf, int offset)
           
protected static void writeUint24(int i, java.io.OutputStream os)
           
protected static void writeUint32(long i, byte[] buf, int offset)
           
protected static void writeUint32(long i, java.io.OutputStream os)
           
protected static void writeUint64(long i, byte[] buf, int offset)
           
protected static void writeUint64(long i, java.io.OutputStream os)
           
protected static void writeUint8(short i, byte[] buf, int offset)
           
protected static void writeUint8(short i, java.io.OutputStream os)
           
protected static void writeVersion(java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TlsUtils

public TlsUtils()
Method Detail

toByteArray

static byte[] toByteArray(java.lang.String str)

writeUint8

protected static void writeUint8(short i,
                                 java.io.OutputStream os)
                          throws java.io.IOException
Throws:
java.io.IOException

writeUint8

protected static void writeUint8(short i,
                                 byte[] buf,
                                 int offset)

writeUint16

protected static void writeUint16(int i,
                                  java.io.OutputStream os)
                           throws java.io.IOException
Throws:
java.io.IOException

writeUint16

protected static void writeUint16(int i,
                                  byte[] buf,
                                  int offset)

writeUint24

protected static void writeUint24(int i,
                                  java.io.OutputStream os)
                           throws java.io.IOException
Throws:
java.io.IOException

writeUint24

protected static void writeUint24(int i,
                                  byte[] buf,
                                  int offset)

writeUint32

protected static void writeUint32(long i,
                                  java.io.OutputStream os)
                           throws java.io.IOException
Throws:
java.io.IOException

writeUint32

protected static void writeUint32(long i,
                                  byte[] buf,
                                  int offset)

writeUint64

protected static void writeUint64(long i,
                                  java.io.OutputStream os)
                           throws java.io.IOException
Throws:
java.io.IOException

writeUint64

protected static void writeUint64(long i,
                                  byte[] buf,
                                  int offset)

readUint8

protected static short readUint8(java.io.InputStream is)
                          throws java.io.IOException
Throws:
java.io.IOException

readUint16

protected static int readUint16(java.io.InputStream is)
                         throws java.io.IOException
Throws:
java.io.IOException

readUint24

protected static int readUint24(java.io.InputStream is)
                         throws java.io.IOException
Throws:
java.io.IOException

readUint32

protected static long readUint32(java.io.InputStream is)
                          throws java.io.IOException
Throws:
java.io.IOException

readFully

protected static void readFully(byte[] buf,
                                java.io.InputStream is)
                         throws java.io.IOException
Throws:
java.io.IOException

checkVersion

protected static void checkVersion(byte[] readVersion,
                                   TlsProtocolHandler handler)
                            throws java.io.IOException
Throws:
java.io.IOException

checkVersion

protected static void checkVersion(java.io.InputStream is,
                                   TlsProtocolHandler handler)
                            throws java.io.IOException
Throws:
java.io.IOException

writeVersion

protected static void writeVersion(java.io.OutputStream os)
                            throws java.io.IOException
Throws:
java.io.IOException

hmac_hash

private static void hmac_hash(Digest digest,
                              byte[] secret,
                              byte[] seed,
                              byte[] out)

PRF

protected static void PRF(byte[] secret,
                          byte[] label,
                          byte[] seed,
                          byte[] buf)