Constructor and Description |
---|
TlsBlockCipher(TlsCryptoParameters cryptoParams,
TlsBlockCipherImpl encryptCipher,
TlsBlockCipherImpl decryptCipher,
TlsHMAC clientMac,
TlsHMAC serverMac,
int cipherKeySize) |
Modifier and Type | Method and Description |
---|---|
TlsDecodeResult |
decodeCiphertext(long seqNo,
short recordType,
ProtocolVersion recordVersion,
byte[] ciphertext,
int offset,
int len)
Decode the passed in ciphertext using the current bulk cipher.
|
TlsEncodeResult |
encodePlaintext(long seqNo,
short contentType,
ProtocolVersion recordVersion,
int headerAllocation,
byte[] plaintext,
int offset,
int len)
Encode the passed in plaintext using the current bulk cipher.
|
int |
getCiphertextDecodeLimit(int plaintextLimit)
Return the maximum input size for a ciphertext given a maximum output size for the plaintext
of plaintextLimit bytes.
|
int |
getCiphertextEncodeLimit(int plaintextLimit)
Return the maximum output size for a ciphertext given a maximum input size for the plaintext of
plaintextLimit bytes.
|
int |
getPlaintextDecodeLimit(int ciphertextLimit)
Return the maximum output size for the plaintext given a maximum input size for the ciphertext of
ciphertextLimit bytes.
|
int |
getPlaintextEncodeLimit(int ciphertextLimit)
Return the maximum input size for the plaintext given a maximum output size for the ciphertext of
ciphertextLimit bytes.
|
void |
rekeyDecoder() |
void |
rekeyEncoder() |
boolean |
usesOpaqueRecordTypeDecode() |
boolean |
usesOpaqueRecordTypeEncode() |
public TlsBlockCipher(TlsCryptoParameters cryptoParams, TlsBlockCipherImpl encryptCipher, TlsBlockCipherImpl decryptCipher, TlsHMAC clientMac, TlsHMAC serverMac, int cipherKeySize) throws java.io.IOException
java.io.IOException
public int getCiphertextDecodeLimit(int plaintextLimit)
TlsCipher
getCiphertextDecodeLimit
in interface TlsCipher
plaintextLimit
- the maximum output size for the plaintext.public int getCiphertextEncodeLimit(int plaintextLimit)
TlsCipher
getCiphertextEncodeLimit
in interface TlsCipher
plaintextLimit
- the maximum input size for the plaintext.public int getPlaintextDecodeLimit(int ciphertextLimit)
TlsCipher
getPlaintextDecodeLimit
in interface TlsCipher
ciphertextLimit
- the maximum input size for the ciphertext.public int getPlaintextEncodeLimit(int ciphertextLimit)
TlsCipher
getPlaintextEncodeLimit
in interface TlsCipher
ciphertextLimit
- the maximum output size for the ciphertext.public TlsEncodeResult encodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len) throws java.io.IOException
TlsCipher
encodePlaintext
in interface TlsCipher
seqNo
- sequence number of the message represented by plaintext.contentType
- content type of the message represented by plaintext.recordVersion
- ProtocolVersion
used for the record.headerAllocation
- extra bytes to allocate at start of returned byte array.plaintext
- array holding input plaintext to the cipher.offset
- offset into input array the plaintext starts at.len
- length of the plaintext in the array.TlsEncodeResult
containing the result of encoding (after 'headerAllocation' unused bytes).java.io.IOException
public TlsDecodeResult decodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len) throws java.io.IOException
TlsCipher
decodeCiphertext
in interface TlsCipher
seqNo
- sequence number of the message represented by ciphertext.recordType
- content type used in the record for this message.recordVersion
- ProtocolVersion
used for the record.ciphertext
- array holding input ciphertext to the cipher.offset
- offset into input array the ciphertext starts at.len
- length of the ciphertext in the array.TlsDecodeResult
containing the result of decoding.java.io.IOException
public void rekeyDecoder() throws java.io.IOException
rekeyDecoder
in interface TlsCipher
java.io.IOException
public void rekeyEncoder() throws java.io.IOException
rekeyEncoder
in interface TlsCipher
java.io.IOException
public boolean usesOpaqueRecordTypeDecode()
usesOpaqueRecordTypeDecode
in interface TlsCipher
public boolean usesOpaqueRecordTypeEncode()
usesOpaqueRecordTypeEncode
in interface TlsCipher