Top Description Methods
org.bouncycastle.tls.crypto

public Interface TlsCipher

Known Direct Implementers
org.bouncycastle.tls.crypto.TlsNullNullCipher, org.bouncycastle.tls.crypto.impl.TlsAEADCipher, org.bouncycastle.tls.crypto.impl.TlsBlockCipher, org.bouncycastle.tls.crypto.impl.TlsNullCipher
Imports
java.io.IOException, org.bouncycastle.tls.ProtocolVersion

Base interface for a TLS bulk cipher.

Method Summary

Modifier and TypeMethod and Description
public TlsDecodeResult

Returns:

A TlsDecodeResult containing the result of decoding.
decodeCiphertext
(long
sequence number of the message represented by ciphertext.
seqNo
,
short
content type used in the record for this message.
recordType
,
ProtocolVersion
ProtocolVersion used for the record.
recordVersion
,
byte[]
array holding input ciphertext to the cipher.
ciphertext
,
int
offset into input array the ciphertext starts at.
offset
,
int
length of the ciphertext in the array.
len
)

Decode the passed in ciphertext using the current bulk cipher.

public TlsEncodeResult

Returns:

A TlsEncodeResult containing the result of encoding (after 'headerAllocation' unused bytes).
encodePlaintext
(long
sequence number of the message represented by plaintext.
seqNo
,
short
content type of the message represented by plaintext.
contentType
,
ProtocolVersion
ProtocolVersion used for the record.
recordVersion
,
int
extra bytes to allocate at start of returned byte array.
headerAllocation
,
byte[]
array holding input plaintext to the cipher.
plaintext
,
int
offset into input array the plaintext starts at.
offset
,
int
length of the plaintext in the array.
len
)

Encode the passed in plaintext using the current bulk cipher.

public int

Returns:

the maximum input size of the ciphertext for plaintextLimit bytes of output.
getCiphertextDecodeLimit
(int
the maximum output size for the plaintext.
plaintextLimit
)

Return the maximum input size for a ciphertext given a maximum output size for the plaintext of plaintextLimit bytes.

public int

Returns:

the maximum output size of the ciphertext for plaintextLimit bytes of input.
getCiphertextEncodeLimit
(int
the maximum input size for the plaintext.
plaintextLimit
)

Return the maximum output size for a ciphertext given a maximum input size for the plaintext of plaintextLimit bytes.

public int

Returns:

the maximum output size of the plaintext for ciphertextLimit bytes of input.
getPlaintextDecodeLimit
(int
the maximum input size for the ciphertext.
ciphertextLimit
)

Return the maximum output size for the plaintext given a maximum input size for the ciphertext of ciphertextLimit bytes.

public int

Returns:

the maximum input size of the plaintext for ciphertextLimit bytes of output.
getPlaintextEncodeLimit
(int
the maximum output size for the ciphertext.
ciphertextLimit
)

Return the maximum input size for the plaintext given a maximum output size for the ciphertext of ciphertextLimit bytes.

public void
public void
public boolean
public boolean

Method Detail

decodeCiphertextback to summary
public TlsDecodeResult decodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len) throws IOException

Decode the passed in ciphertext using the current bulk cipher.

Parameters
seqNo:long

sequence number of the message represented by ciphertext.

recordType:short

content type used in the record for this message.

recordVersion:ProtocolVersion

ProtocolVersion used for the record.

ciphertext:byte[]

array holding input ciphertext to the cipher.

offset:int

offset into input array the ciphertext starts at.

len:int

length of the ciphertext in the array.

Returns:TlsDecodeResult

A TlsDecodeResult containing the result of decoding.

encodePlaintextback to summary
public TlsEncodeResult encodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len) throws IOException

Encode the passed in plaintext using the current bulk cipher.

Parameters
seqNo:long

sequence number of the message represented by plaintext.

contentType:short

content type of the message represented by plaintext.

recordVersion:ProtocolVersion

ProtocolVersion used for the record.

headerAllocation:int

extra bytes to allocate at start of returned byte array.

plaintext:byte[]

array holding input plaintext to the cipher.

offset:int

offset into input array the plaintext starts at.

len:int

length of the plaintext in the array.

Returns:TlsEncodeResult

A TlsEncodeResult containing the result of encoding (after 'headerAllocation' unused bytes).

getCiphertextDecodeLimitback to summary
public int getCiphertextDecodeLimit(int plaintextLimit)

Return the maximum input size for a ciphertext given a maximum output size for the plaintext of plaintextLimit bytes.

Parameters
plaintextLimit:int

the maximum output size for the plaintext.

Returns:int

the maximum input size of the ciphertext for plaintextLimit bytes of output.

getCiphertextEncodeLimitback to summary
public int getCiphertextEncodeLimit(int plaintextLimit)

Return the maximum output size for a ciphertext given a maximum input size for the plaintext of plaintextLimit bytes.

Parameters
plaintextLimit:int

the maximum input size for the plaintext.

Returns:int

the maximum output size of the ciphertext for plaintextLimit bytes of input.

getPlaintextDecodeLimitback to summary
public int getPlaintextDecodeLimit(int ciphertextLimit)

Return the maximum output size for the plaintext given a maximum input size for the ciphertext of ciphertextLimit bytes.

Parameters
ciphertextLimit:int

the maximum input size for the ciphertext.

Returns:int

the maximum output size of the plaintext for ciphertextLimit bytes of input.

getPlaintextEncodeLimitback to summary
public int getPlaintextEncodeLimit(int ciphertextLimit)

Return the maximum input size for the plaintext given a maximum output size for the ciphertext of ciphertextLimit bytes.

Parameters
ciphertextLimit:int

the maximum output size for the ciphertext.

Returns:int

the maximum input size of the plaintext for ciphertextLimit bytes of output.

rekeyDecoderback to summary
public void rekeyDecoder() throws IOException
rekeyEncoderback to summary
public void rekeyEncoder() throws IOException
usesOpaqueRecordTypeDecodeback to summary
public boolean usesOpaqueRecordTypeDecode()
usesOpaqueRecordTypeEncodeback to summary
public boolean usesOpaqueRecordTypeEncode()