Interface TlsDTLS13Cipher
- All Known Implementing Classes:
TlsAEADCipher
public interface TlsDTLS13Cipher
The optional DTLS 1.3 (RFC 9147) record protection extension to
TlsCipher, implemented by ciphers
that can protect DTLS 1.3 records.-
Method Summary
Modifier and TypeMethodDescriptiondecodeDTLS13Ciphertext(long seqNo, byte[] record, int recordOff, int headerLen, int ciphertextLen) Decode a received DTLS 1.3 protected record.voiddecryptDTLS13RecordNumber(byte[] record, int recordOff, int recordLen) Decrypt (in place) the record number of a received DTLS 1.3 protected record (RFC 9147 4.2.3).encodeDTLS13Plaintext(long seqNo, short contentType, byte[] header, int headerOff, int headerLen, byte[] plaintext, int offset, int len) Encode the passed in plaintext as a DTLS 1.3 protected record (RFC 9147 4).
-
Method Details
-
encodeDTLS13Plaintext
TlsEncodeResult encodeDTLS13Plaintext(long seqNo, short contentType, byte[] header, int headerOff, int headerLen, byte[] plaintext, int offset, int len) throws IOException Encode the passed in plaintext as a DTLS 1.3 protected record (RFC 9147 4). The supplied unified header is the AEAD additional data; when its L bit is set the (zeroed) length field is filled in by this method. The returned record holds the header, with record number encryption (RFC 9147 4.2.3) applied to its sequence number bytes, followed by the encrypted record.- Parameters:
seqNo- the 64-bit record sequence number (the epoch is not included, unlike DTLS 1.2).contentType- the true content type, written into the DTLSInnerPlaintext.header- array holding the unified header with the sequence number in the clear.headerOff- offset of the header in the array.headerLen- length of the header.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
TlsEncodeResultwhose buffer holds the complete record (header followed by ciphertext), with 'recordType' set to the first byte of the unified header. - Throws:
IOException
-
decryptDTLS13RecordNumber
Decrypt (in place) the record number of a received DTLS 1.3 protected record (RFC 9147 4.2.3). The record starts with its unified header; at least 16 bytes of ciphertext must follow the header.- Parameters:
record- array holding the received record.recordOff- offset of the record (its unified header) in the array.recordLen- length of the record.- Throws:
IOException
-
decodeDTLS13Ciphertext
TlsDecodeResult decodeDTLS13Ciphertext(long seqNo, byte[] record, int recordOff, int headerLen, int ciphertextLen) throws IOException Decode a received DTLS 1.3 protected record. The unified header (with the sequence number already decrypted) at 'recordOff' is the AEAD additional data, and the ciphertext immediately follows it.- Parameters:
seqNo- the 64-bit record sequence number reconstructed by the caller (the epoch is not included).record- array holding the received record.recordOff- offset of the record (its unified header) in the array.headerLen- length of the unified header.ciphertextLen- length of the ciphertext following the header.- Returns:
- A
TlsDecodeResultcontaining the result of decoding. - Throws:
IOException
-