Package org.bouncycastle.tls.crypto
Interface TlsCipher
-
- All Known Implementing Classes:
TlsAEADCipher,TlsBlockCipher,TlsNullCipher,TlsNullNullCipher
public interface TlsCipherBase interface for a TLS bulk cipher.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TlsDecodeResultdecodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len)Decode the passed in ciphertext using the current bulk cipher.TlsEncodeResultencodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len)Encode the passed in plaintext using the current bulk cipher.intgetCiphertextDecodeLimit(int plaintextLimit)Return the maximum input size for a ciphertext given a maximum output size for the plaintext of plaintextLimit bytes.intgetCiphertextEncodeLimit(int plaintextLimit)Return the maximum output size for a ciphertext given a maximum input size for the plaintext of plaintextLimit bytes.intgetPlaintextDecodeLimit(int ciphertextLimit)Return the maximum output size for the plaintext given a maximum input size for the ciphertext of ciphertextLimit bytes.intgetPlaintextEncodeLimit(int ciphertextLimit)Return the maximum input size for the plaintext given a maximum output size for the ciphertext of ciphertextLimit bytes.voidrekeyDecoder()voidrekeyEncoder()booleanusesOpaqueRecordTypeDecode()booleanusesOpaqueRecordTypeEncode()
-
-
-
Method Detail
-
getCiphertextDecodeLimit
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- the maximum output size for the plaintext.- Returns:
- the maximum input size of the ciphertext for plaintextLimit bytes of output.
-
getCiphertextEncodeLimit
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- the maximum input size for the plaintext.- Returns:
- the maximum output size of the ciphertext for plaintextLimit bytes of input.
-
getPlaintextDecodeLimit
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- the maximum input size for the ciphertext.- Returns:
- the maximum output size of the plaintext for ciphertextLimit bytes of input.
-
getPlaintextEncodeLimit
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- the maximum output size for the ciphertext.- Returns:
- the maximum input size of the plaintext for ciphertextLimit bytes of output.
-
encodePlaintext
TlsEncodeResult encodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len) throws java.io.IOException
Encode the passed in plaintext using the current bulk cipher.- Parameters:
seqNo- sequence number of the message represented by plaintext.contentType- content type of the message represented by plaintext.recordVersion-ProtocolVersionused 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.- Returns:
- A
TlsEncodeResultcontaining the result of encoding (after 'headerAllocation' unused bytes). - Throws:
java.io.IOException
-
decodeCiphertext
TlsDecodeResult decodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len) throws java.io.IOException
Decode the passed in ciphertext using the current bulk cipher.- Parameters:
seqNo- sequence number of the message represented by ciphertext.recordType- content type used in the record for this message.recordVersion-ProtocolVersionused 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.- Returns:
- A
TlsDecodeResultcontaining the result of decoding. - Throws:
java.io.IOException
-
rekeyDecoder
void rekeyDecoder() throws java.io.IOException- Throws:
java.io.IOException
-
rekeyEncoder
void rekeyEncoder() throws java.io.IOException- Throws:
java.io.IOException
-
usesOpaqueRecordTypeDecode
boolean usesOpaqueRecordTypeDecode()
-
usesOpaqueRecordTypeEncode
boolean usesOpaqueRecordTypeEncode()
-
-