org.bouncycastle.crypto.tls

Class TlsUtils


public class TlsUtils
extends java.lang.Object

Some helper fuctions for MicroTLS.

Method Summary

protected static void
PRF(byte[] secret, byte[] label, byte[] seed, byte[] buf)
protected static void
checkVersion(InputStream is, TlsProtocolHandler handler)
protected static void
checkVersion(byte[] readVersion, TlsProtocolHandler handler)
protected static void
readFully(byte[] buf, InputStream is)
protected static int
readUint16(InputStream is)
protected static int
readUint24(InputStream is)
protected static long
readUint32(InputStream is)
protected static short
readUint8(InputStream is)
protected static void
writeUint16(int i, OutputStream os)
protected static void
writeUint16(int i, byte[] buf, int offset)
protected static void
writeUint24(int i, OutputStream os)
protected static void
writeUint24(int i, byte[] buf, int offset)
protected static void
writeUint32(long i, OutputStream os)
protected static void
writeUint32(long i, byte[] buf, int offset)
protected static void
writeUint64(long i, OutputStream os)
protected static void
writeUint64(long i, byte[] buf, int offset)
protected static void
writeUint8(short i, OutputStream os)
protected static void
writeUint8(short i, byte[] buf, int offset)
protected static void
writeVersion(OutputStream os)

Method Details

PRF

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

checkVersion

protected static void checkVersion(InputStream is,
                                   TlsProtocolHandler handler)
            throws IOException

checkVersion

protected static void checkVersion(byte[] readVersion,
                                   TlsProtocolHandler handler)
            throws IOException

readFully

protected static void readFully(byte[] buf,
                                InputStream is)
            throws IOException

readUint16

protected static int readUint16(InputStream is)
            throws IOException

readUint24

protected static int readUint24(InputStream is)
            throws IOException

readUint32

protected static long readUint32(InputStream is)
            throws IOException

readUint8

protected static short readUint8(InputStream is)
            throws IOException

writeUint16

protected static void writeUint16(int i,
                                  OutputStream os)
            throws IOException

writeUint16

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

writeUint24

protected static void writeUint24(int i,
                                  OutputStream os)
            throws IOException

writeUint24

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

writeUint32

protected static void writeUint32(long i,
                                  OutputStream os)
            throws IOException

writeUint32

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

writeUint64

protected static void writeUint64(long i,
                                  OutputStream os)
            throws IOException

writeUint64

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

writeUint8

protected static void writeUint8(short i,
                                 OutputStream os)
            throws IOException

writeUint8

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

writeVersion

protected static void writeVersion(OutputStream os)
            throws IOException