public abstract class DTLSConnectionState extends Object implements Destroyable
According to the TLS 1.2 specification, a connection state specifies a compression algorithm, an encryption algorithm, and a MAC algorithm. In addition, the parameters for these algorithms are known: the MAC key and the bulk encryption keys for the connection in both the read and the write directions.
This class is immutable and thus only appropriate to reflect a current read or write state whose properties have been negotiated/established already.
| Modifier and Type | Field and Description |
|---|---|
protected CipherSuite |
cipherSuite |
protected CompressionMethod |
compressionMethod |
static DTLSConnectionState |
NULL |
| Modifier and Type | Method and Description |
|---|---|
static DTLSConnectionState |
create(CipherSuite cipherSuite,
CompressionMethod compressionMethod,
SecretKey encryptionKey,
SecretIvParameterSpec iv,
SecretKey macKey)
Create connection state and initializes all fields with given values.
|
abstract byte[] |
decrypt(Record record,
byte[] ciphertextFragment)
Decrypt fragment for provided record.
|
abstract byte[] |
encrypt(Record record,
byte[] fragment)
Encrypt fragment for provided record.
|
boolean |
hasValidCipherSuite()
Checks whether the cipher suite is not the NULL_CIPHER.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, isDestroyedpublic static final DTLSConnectionState NULL
protected final CipherSuite cipherSuite
protected final CompressionMethod compressionMethod
public static DTLSConnectionState create(CipherSuite cipherSuite, CompressionMethod compressionMethod, SecretKey encryptionKey, SecretIvParameterSpec iv, SecretKey macKey)
cipherSuite - the cipher and MAC algorithm to use for encrypting
message contentcompressionMethod - the algorithm to use for compressing message
contentencryptionKey - the secret key to use for encrypting message contentiv - the initialization vector to use for encrypting message contentmacKey - the key to use for creating/verifying message
authentication codes (MAC)NullPointerException - if any of the parameter is nullpublic boolean hasValidCipherSuite()
true if the suite is not CipherSuite.TLS_NULL_WITH_NULL_NULL.public abstract byte[] encrypt(Record record, byte[] fragment) throws GeneralSecurityException
record - record to encrypt fragment forfragment - fragment to encryptGeneralSecurityException - if an error occured during encryptionpublic abstract byte[] decrypt(Record record, byte[] ciphertextFragment) throws GeneralSecurityException
record - record to decrypt fragment forciphertextFragment - encrypted fragmentGeneralSecurityException - if an error occurred during decryptionCopyright © 2023 Eclipse Foundation. All rights reserved.