Top Fields Constructors Methods
org.bouncycastle.tls

public abstract Class TlsProtocol

extends Object
implements TlsCloseable
Class Inheritance
All Implemented Interfaces
org.bouncycastle.tls.TlsCloseable
Known Direct Subclasses
org.bouncycastle.tls.TlsServerProtocol, org.bouncycastle.tls.TlsClientProtocol
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .EOFException, .IOException, .InputStream, .InterruptedIOException, .OutputStream, java.nio.ByteBuffer, java.util.Enumeration, .Hashtable, .Vector, org.bouncycastle.tls.crypto.TlsCrypto, .TlsSecret, org.bouncycastle.util.Arrays, .Integers

Field Summary

Modifier and TypeField and Description
protected static final short
protected static final short
protected static final short
private ByteQueue
private volatile boolean
private volatile boolean
private volatile int
private ByteQueue
protected boolean
protected Hashtable<K, V>
private volatile boolean
protected short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected static final short
protected boolean
protected static final Integer
protected static final Integer
private volatile boolean
pack-priv TlsHandshakeHash
private ByteQueue
protected ByteQueueInputStream
private volatile boolean
private volatile boolean
private int
protected ByteQueueOutputStream
protected boolean
pack-priv final RecordStream
pack-priv final Object
private volatile boolean
protected byte[]
protected int
protected boolean
protected Hashtable<K, V>
protected TlsSecret
protected SessionParameters
private TlsInputStream
private TlsOutputStream
protected TlsSession

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public int
protected void
applyMaxFragmentLengthExtension(short maxFragmentLength)

protected static void
assertEmpty(ByteArrayInputStream
The InputStream to check.
buf
)

Make sure the InputStream 'buf' now empty.

protected void
beginHandshake(boolean renegotiation)

protected void
protected void
protected void
protected void
public void
close()

Implements org.bouncycastle.tls.TlsCloseable.close.

Closes this connection.
protected void
public void
closeInput()

Should be called in non-blocking mode when the input data reaches EOF.

protected void
protected static byte[]
createRandomBlock(boolean useGMTUnixTime, TlsContext context)

protected static byte[]
createRenegotiationInfo(byte[] renegotiated_connection)

protected static void
protected boolean
establishSession(TlsSession sessionToResume)

public void
public int
public int
public int

Returns:

The number of bytes of available application data
getAvailableInputBytes
()

Gets the amount of received application data.

public int

Returns:

The number of bytes of available encrypted data
getAvailableOutputBytes
()

Gets the amount of encrypted data available to be sent.

protected abstract TlsContext
pack-priv abstract AbstractTlsContext
public InputStream

Returns:

An InputStream which can be used to read data. Only allowed in blocking mode.
getInputStream
()

public OutputStream

Returns:

An OutputStream which can be used to send data. Only allowed in blocking mode.
getOutputStream
()

protected abstract TlsPeer
protected int
protected void
handleAlertMessage(short alertLevel, short alertDescription)

protected void
handleAlertWarningMessage(short alertDescription)

protected void
protected void
handleClose(boolean user_canceled)

protected void
handleException(short alertDescription, String message, Throwable e)

protected void
protected abstract void
protected boolean
protected void
pack-priv boolean
public boolean
public boolean
public boolean
protected boolean
public boolean
protected boolean
public void
offerInput(byte[]
The input buffer to offer
input
)

Equivalent to offerInput(input, 0, input.length)

public void
offerInput(byte[]
The input buffer to offer
input
,
int
The offset within the input buffer that input begins
inputOff
,
int
The number of bytes of input being offered
inputLen
)

Offer input from an arbitrary source.

public RecordPreview
previewInputRecord(byte[] recordHeader)

public int
public RecordPreview
previewOutputRecord(int applicationDataSize)

protected void
private void
private void
private void
processChangeCipherSpec(byte[] buf, int off, int len)

This method is called, when a change cipher spec message is received.

protected void
private void
protected short
processMaxFragmentLengthExtension(Hashtable<K, V> clientExtensions, Hashtable<K, V> serverExtensions, short alertDescription)

Deprecated Will be removed.
protected void
processRecord(short protocol, byte[] buf, int off, int len)

protected void
raiseAlertFatal(short alertDescription, String message, Throwable cause)

protected void
raiseAlertWarning(short alertDescription, String message)

public int

Returns:

The number of bytes read.
readApplicationData
(byte[]
The buffer where the data will be copied to.
buf
,
int
The position where the data will be placed in the buffer.
off
,
int
The maximum number of bytes to read.
len
)

Read data from the network.

protected static Hashtable<K, V>
protected static Hashtable<K, V>
readExtensionsData(byte[] extBytes)

protected static Hashtable<K, V>
readExtensionsData13(int handshakeType, byte[] extBytes)

protected static Hashtable<K, V>
public int

Returns:

The total number of bytes copied to the buffer. May be less than the length specified if the length was greater than the amount of available data.
readInput
(byte[]
The buffer to hold the application data
buffer
,
int
The start offset in the buffer at which the data is written
offset
,
int
The maximum number of bytes to read
length
)

Retrieves received application data.

public int

Returns:

The total number of bytes copied to the buffer. May be less than the length specified if the length was greater than the amount of available data.
readInput
(ByteBuffer
The ByteBuffer to hold the application data
buffer
,
int
The maximum number of bytes to read
length
)

Retrieves received application data into a ByteBuffer.

public int

Returns:

The total number of bytes copied to the buffer. May be less than the length specified if the length was greater than the amount of available data.
readOutput
(byte[]
The buffer to hold the encrypted data
buffer
,
int
The start offset in the buffer at which the data is written
offset
,
int
The maximum number of bytes to read
length
)

Retrieves encrypted data to be sent.

public int

Returns:

The total number of bytes copied to the buffer. May be less than the length specified if the length was greater than the amount of available data.
readOutput
(ByteBuffer
The ByteBuffer to hold the encrypted data
buffer
,
int
The maximum number of bytes to read
length
)

Retrieves encrypted data to be sent.

protected static Vector<E>
protected void
protected void
public void
protected RecordPreview
safePreviewRecordHeader(byte[] recordHeader)

protected boolean
safeReadFullRecord(byte[] input, int inputOff, int inputLen)

protected void
protected void
safeWriteRecord(short type, byte[] buf, int offset, int len)

protected void
protected void
protected void
protected void
send13KeyUpdate(boolean updateRequested)

protected void
sendCertificateMessage(Certificate certificate, OutputStream endPointHash)

protected void
protected void
protected void
protected void
sendSupplementalDataMessage(Vector<E> supplementalData)

public void
setAppDataSplitMode(int appDataSplitMode)

public void
setResumableHandshake(boolean resumableHandshake)

public void
writeApplicationData(byte[]
The buffer containing application data to send
buf
,
int
The offset at which the application data begins
off
,
int
The number of bytes of application data
len
)

Write some application data.

protected static void
writeExtensions(OutputStream output, Hashtable<K, V> extensions)

protected static void
writeExtensions(OutputStream output, Hashtable<K, V> extensions, int bindersSize)

protected static byte[]
writeExtensionsData(Hashtable<K, V> extensions)

protected static byte[]
writeExtensionsData(Hashtable<K, V> extensions, int bindersSize)

protected static void
writeExtensionsData(Hashtable<K, V> extensions, int bindersSize, ByteArrayOutputStream buf)

pack-priv void
writeHandshakeMessage(byte[] buf, int off, int len)

protected static void
writePreSharedKeyExtension(OutputStream output, Hashtable<K, V> extensions, int bindersSize)

protected static void
writeSelectedExtensions(OutputStream output, Hashtable<K, V> extensions, boolean selectEmpty)

protected static void
writeSupplementalData(OutputStream output, Vector<E> supplementalData)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait