Modifier and Type | Field and Description |
---|---|
static int |
AEAD_CCM |
static int |
AEAD_CHACHA20_POLY1305 |
static int |
AEAD_GCM |
protected TlsCryptoParameters |
cryptoParams |
protected TlsAEADCipherImpl |
decryptCipher |
protected byte[] |
decryptNonce |
protected TlsAEADCipherImpl |
encryptCipher |
protected byte[] |
encryptNonce |
protected int |
fixed_iv_length |
protected boolean |
isTLSv13 |
protected int |
keySize |
protected int |
macSize |
protected int |
nonceMode |
protected int |
record_iv_length |
Constructor and Description |
---|
TlsAEADCipher(TlsCryptoParameters cryptoParams,
TlsAEADCipherImpl encryptCipher,
TlsAEADCipherImpl decryptCipher,
int keySize,
int macSize,
int aeadType) |
Modifier and Type | Method and Description |
---|---|
TlsDecodeResult |
decodeCiphertext(long seqNo,
short recordType,
ProtocolVersion recordVersion,
byte[] ciphertext,
int ciphertextOffset,
int ciphertextLength)
Decode the passed in ciphertext using the current bulk cipher.
|
TlsEncodeResult |
encodePlaintext(long seqNo,
short contentType,
ProtocolVersion recordVersion,
int headerAllocation,
byte[] plaintext,
int plaintextOffset,
int plaintextLength)
Encode the passed in plaintext using the current bulk cipher.
|
protected byte[] |
getAdditionalData(long seqNo,
short recordType,
ProtocolVersion recordVersion,
int ciphertextLength,
int plaintextLength) |
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 plaintextLength,
int plaintextLimit)
Return the maximum output size for a ciphertext given an actual input plaintext size of
plaintextLength bytes and a maximum input plaintext size of plaintextLimit bytes.
|
int |
getPlaintextLimit(int ciphertextLimit)
Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext.
|
protected void |
rekeyCipher(SecurityParameters securityParameters,
TlsAEADCipherImpl cipher,
byte[] nonce,
boolean serverSecret) |
void |
rekeyDecoder() |
void |
rekeyEncoder() |
protected void |
setup13Cipher(TlsAEADCipherImpl cipher,
byte[] nonce,
TlsSecret secret,
int cryptoHashAlgorithm) |
boolean |
usesOpaqueRecordType() |
public static final int AEAD_CCM
public static final int AEAD_CHACHA20_POLY1305
public static final int AEAD_GCM
protected final TlsCryptoParameters cryptoParams
protected final int keySize
protected final int macSize
protected final int fixed_iv_length
protected final int record_iv_length
protected final TlsAEADCipherImpl decryptCipher
protected final TlsAEADCipherImpl encryptCipher
protected final byte[] decryptNonce
protected final byte[] encryptNonce
protected final boolean isTLSv13
protected final int nonceMode
public TlsAEADCipher(TlsCryptoParameters cryptoParams, TlsAEADCipherImpl encryptCipher, TlsAEADCipherImpl decryptCipher, int keySize, int macSize, int aeadType) 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 plaintextLength, int plaintextLimit)
TlsCipher
getCiphertextEncodeLimit
in interface TlsCipher
plaintextLength
- the actual input size for the plaintext.plaintextLimit
- the maximum input size for the plaintext.public int getPlaintextLimit(int ciphertextLimit)
TlsCipher
getPlaintextLimit
in interface TlsCipher
ciphertextLimit
- the maximum number of bytes of ciphertext.public TlsEncodeResult encodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int plaintextOffset, int plaintextLength) 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.plaintextOffset
- offset into input array the plaintext starts at.plaintextLength
- 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 ciphertextOffset, int ciphertextLength) 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.ciphertextOffset
- offset into input array the ciphertext starts at.ciphertextLength
- 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 usesOpaqueRecordType()
usesOpaqueRecordType
in interface TlsCipher
protected byte[] getAdditionalData(long seqNo, short recordType, ProtocolVersion recordVersion, int ciphertextLength, int plaintextLength) throws java.io.IOException
java.io.IOException
protected void rekeyCipher(SecurityParameters securityParameters, TlsAEADCipherImpl cipher, byte[] nonce, boolean serverSecret) throws java.io.IOException
java.io.IOException
protected void setup13Cipher(TlsAEADCipherImpl cipher, byte[] nonce, TlsSecret secret, int cryptoHashAlgorithm) throws java.io.IOException
java.io.IOException