public final class DtlsConnectorConfig extends Object
DTLSConnector.
Instances of this class are immutable and can only be created by means of
the DtlsConnectorConfig.Builder, e.g.
InetSocketAddress bindToAddress = new InetSocketAddress("localhost", 0); // use ephemeral port
DtlsConnectorConfig config = new DtlsConnectorConfig.Builder()
.setAddress(bindToAddress)
.setPskStore(new StaticPskStore("identity", "secret".getBytes()))
.set... // additional configuration
.build();
DTLSConnector connector = new DTLSConnector(config);
connector.start();
...
| Modifier and Type | Class and Description |
|---|---|
static class |
DtlsConnectorConfig.Builder
A helper for creating instances of
DtlsConnectorConfig
based on the builder pattern. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_CONNECTIONS
The default value for the maxConncetions property.
|
static int |
DEFAULT_MAX_DEFERRED_PROCESSED_APPLICATION_DATA_MESSAGES
The default value for the maxDeferredProcessedApplicationDataMessages property.
|
static int |
DEFAULT_MAX_DEFERRED_PROCESSED_HANDSHAKE_RECORDS_SIZE
The default value for the maxDeferredProcessedHandshakeRecordsSize property.
|
static int |
DEFAULT_MAX_FRAGMENTED_HANDSHAKE_MESSAGE_LENGTH
The default value for the maxFragmentedHandshakeMessageLength property.
|
static int |
DEFAULT_MAX_RETRANSMISSIONS
The default value for the maxRetransmissions property.
|
static int |
DEFAULT_MAX_TRANSMISSION_UNIT_LIMIT
The default value for the maxTransmissionUnitLimit property.
|
static int |
DEFAULT_RETRANSMISSION_TIMEOUT_MS
The default value for the retransmissionTimeout property.
|
static long |
DEFAULT_STALE_CONNECTION_TRESHOLD
The default value for the staleConnectionThreshold property.
|
static int |
DEFAULT_VERIFY_PEERS_ON_RESUMPTION_THRESHOLD_IN_PERCENT
The default value for the verifyPeersOnResumptionThreshold
property.
|
| Modifier and Type | Method and Description |
|---|---|
static DtlsConnectorConfig.Builder |
builder()
Create new builder for DtlsConnectorConfig.
|
static DtlsConnectorConfig.Builder |
builder(DtlsConnectorConfig config)
Create builder for DtlsConnectorConfig from provided DtlsConnectorConfig.
|
protected Object |
clone() |
InetSocketAddress |
getAddress()
Gets the IP address and port the connector is bound to.
|
NewAdvancedCertificateVerifier |
getAdvancedCertificateVerifier()
Gets the new advanced certificate verifier to be used during the DTLS
handshake.
|
AdvancedPskStore |
getAdvancedPskStore()
Gets the advanced registry of shared secrets used for
authenticating clients during a DTLS handshake.
|
ApplicationLevelInfoSupplier |
getApplicationLevelInfoSupplier()
Gets the supplier of application level information for an authenticated peer's identity.
|
Long |
getAutoResumptionTimeoutMillis()
Get the timeout for automatic session resumption.
|
Integer |
getBackOffRetransmission()
Number of retransmissions before the attempt to transmit a flight in
back-off mode.
|
List<X509Certificate> |
getCertificateChain()
Gets the certificates forming the chain-of-trust from
a root CA down to the certificate asserting the server's identity.
|
CertificateVerifier |
getCertificateVerifier()
Gets the verifier in charge of validating the peer's certificate chain
during the DTLS handshake.
|
CipherSuiteSelector |
getCipherSuiteSelector()
Get cipher suite selector.
|
ConnectionIdGenerator |
getConnectionIdGenerator()
Gets connection ID generator.
|
ConnectionListener |
getConnectionListener() |
Integer |
getConnectionThreadCount()
Gets the number of threads which should be use to handle DTLS connection.
|
String |
getDefaultHandshakeMode()
Get the default handshake mode.
|
DtlsHealth |
getHealthHandler()
Gets health handler.
|
Integer |
getHealthStatusInterval()
Gets health status interval.
|
List<CertificateType> |
getIdentityCertificateTypes()
Gets the certificate types for the identity of this peer.
|
String |
getLoggingTag()
Get instance logging tag.
|
Integer |
getMaxConnections()
Gets the maximum number of (active) connections the connector will support.
|
Integer |
getMaxDeferredProcessedIncomingRecordsSize()
Gets the maximum size of all deferred processed incoming records.
|
Integer |
getMaxDeferredProcessedOutgoingApplicationDataMessages()
Gets the maximum number of deferred processed outgoing application data messages.
|
Integer |
getMaxFragmentedHandshakeMessageLength()
Gets the maximum length of a reassembled fragmented handshake message.
|
Integer |
getMaxFragmentLengthCode()
Gets the maximum amount of message payload data that this connector can receive in a
single DTLS record.
|
Integer |
getMaxRetransmissions()
Gets the maximum number of times a flight of handshake messages gets re-transmitted
to a peer.
|
Integer |
getMaxTransmissionUnit()
Gets the maximum transmission unit.
|
Integer |
getMaxTransmissionUnitLimit()
Gets the maximum transmission unit limit for auto detection.
|
Integer |
getOutboundMessageBufferSize()
Gets the number of outbound messages that can be buffered in memory before
messages are dropped.
|
List<CipherSuite> |
getPreselectedCipherSuites()
Gets the preselected cipher suites.
|
PrivateKey |
getPrivateKey()
Gets the private key to use for proving identity to a peer
during a DTLS handshake.
|
ProtocolVersion |
getProtocolVersionForHelloVerifyRequests()
Get protocol version for hello verify requests to send.
|
PskStore |
getPskStore()
Deprecated.
use
getAdvancedPskStore() instead |
PublicKey |
getPublicKey()
Gets the public key to send to peers during the DTLS handshake
for authentication purposes.
|
Integer |
getReceiverThreadCount()
Gets the number of threads which should be use to receive datagrams
from the socket.
|
Integer |
getRecordSizeLimit()
Gets record size limit.
|
Integer |
getRetransmissionTimeout()
Gets the (initial) time to wait before a handshake flight of messages gets re-transmitted.
|
TrustedRpkStore |
getRpkTrustStore()
Note: the upcoming next major version 3.0 will remove this method.
|
Integer |
getSocketReceiveBufferSize()
Gets size of the socket receive buffer.
|
Integer |
getSocketSendBufferSize()
Gets size of the socket send buffer.
|
Long |
getStaleConnectionThreshold()
Gets the maximum number of seconds within which some records need to be exchanged
over a connection before it is considered stale.
|
List<CipherSuite> |
getSupportedCipherSuites()
Gets the supported cipher suites.
|
List<XECDHECryptography.SupportedGroup> |
getSupportedGroups()
Gets the supported groups (curves).
|
List<SignatureAndHashAlgorithm> |
getSupportedSignatureAlgorithms()
Gets the supported signature and hash algorithms the connector should
advertise in a DTLS handshake.
|
List<CertificateType> |
getTrustCertificateTypes()
Gets the certificate types for the trust of the other peer.
|
X509Certificate[] |
getTrustStore()
Gets the trusted root certificates to use when verifying a peer's
certificate during authentication.
|
Integer |
getVerifyPeersOnResumptionThreshold()
Threshold to use a HELLO_VERIFY_REQUEST also for session resumption in
percent of
getMaxConnections(). |
Boolean |
isAddressReuseEnabled() |
Boolean |
isClientAuthenticationRequired()
Gets whether the connector requires DTLS clients to authenticate during
the handshake.
|
Boolean |
isClientAuthenticationWanted()
Gets whether the connector wants (requests) DTLS clients to authenticate
during the handshake.
|
Boolean |
isClientOnly()
Gets whether the connector acts only as client.
|
Boolean |
isEarlyStopRetransmission() |
Boolean |
isRecommendedCipherSuitesOnly() |
Boolean |
isRecommendedSupportedGroupsOnly() |
Boolean |
isServerOnly()
Gets whether the connector acts only as server and doesn't start new handshakes.
|
Boolean |
isSniEnabled()
Checks whether the connector should support the use of the TLS
Server Name
Indication extension in the DTLS handshake.
|
Boolean |
useAntiReplayFilter()
Use anti replay filter.
|
Boolean |
useCidUpdateAddressOnNewerRecordFilter()
Use filter to update the ip-address from DTLS 1.2 CID
records only for newer records based on epoch/sequence_number.
|
Integer |
useExtendedWindowFilter()
Use filter for records in window and before limit.
|
Boolean |
useHandshakeStateValidation()
Use the handshake state validation to verify valid handshakes.
|
Boolean |
useKeyUsageVerification()
Use key usage verification for x509.
|
Boolean |
useMultiHandshakeMessageRecords()
Enable to use dtls records with multiple handshake messages.
|
Boolean |
useMultiRecordMessages()
Gets enable to use UDP messages with multiple dtls records.
|
Boolean |
useNoServerSessionId()
Indicates, that no session id is used by this server and so session are
also not cached by this server and can not be resumed.
|
Boolean |
useTruncatedCertificatePathForClientsCertificateMessage()
Use truncated certificate paths for client's certificate message.
|
Boolean |
useTruncatedCertificatePathForValidation()
Use truncated certificate paths for validation.
|
Boolean |
useWindowFilter()
Deprecated.
use
useExtendedWindowFilter() instead. |
public static final int DEFAULT_MAX_DEFERRED_PROCESSED_APPLICATION_DATA_MESSAGES
public static final int DEFAULT_MAX_CONNECTIONS
public static final int DEFAULT_MAX_FRAGMENTED_HANDSHAKE_MESSAGE_LENGTH
public static final int DEFAULT_MAX_DEFERRED_PROCESSED_HANDSHAKE_RECORDS_SIZE
public static final long DEFAULT_STALE_CONNECTION_TRESHOLD
public static final int DEFAULT_RETRANSMISSION_TIMEOUT_MS
public static final int DEFAULT_MAX_RETRANSMISSIONS
public static final int DEFAULT_VERIFY_PEERS_ON_RESUMPTION_THRESHOLD_IN_PERCENT
public static final int DEFAULT_MAX_TRANSMISSION_UNIT_LIMIT
public Integer getRecordSizeLimit()
null, if not used.public Integer getMaxFragmentLengthCode()
The code returned is either null or one of the following:
public Integer getMaxFragmentedHandshakeMessageLength()
public Boolean useMultiRecordMessages()
true, if enabled, false, otherwise. null
for default behavior.public Boolean useMultiHandshakeMessageRecords()
true, if enabled, false, otherwise. null
for default behavior.public ProtocolVersion getProtocolVersionForHelloVerifyRequests()
null, to reply the clients
version. Default is null.HelloVerifyRequestpublic Integer getRetransmissionTimeout()
public Integer getMaxDeferredProcessedOutgoingApplicationDataMessages()
public Integer getMaxDeferredProcessedIncomingRecordsSize()
public Integer getBackOffRetransmission()
useMultiHandshakeMessageRecords() and
useMultiRecordMessages() has precedence over the back-off
definition.
Value 0, to disable it, default is value
maxRetransmissions / 2.public Integer getMaxRetransmissions()
public Integer getMaxTransmissionUnit()
public Integer getMaxTransmissionUnitLimit()
public Boolean isEarlyStopRetransmission()
public Boolean isAddressReuseEnabled()
public Boolean isSniEnabled()
If enabled, the client side should send a server name extension, if the
server is specified with hostname rather then with a raw ip-address. The
server side support currently includes a server name specific PSK secret
lookup and a forwarding of the server name to the CoAP stack in the
DtlsEndpointContext. The x509 or RPK credentials lookup is currently
not server name specific, therefore the server's certificate will be the
same, regardless of the indicated server name.
The default value of this property is null. If this property is
not set explicitly using DtlsConnectorConfig.Builder.setSniEnabled(boolean), then the
DtlsConnectorConfig.Builder.build() method will set it to false.
true if SNI should be used.public Integer getVerifyPeersOnResumptionThreshold()
getMaxConnections(). Though a CLIENT_HELLO with an
session id is used in session resumption, that session ID could be used
to check.
Value 0 : always use a verify request. 1 ... 100 : dynamically use a verify request.Peers are identified by their endpoint (ip-address and port) and dtls sessions have a id and may be also related to an endpoint. If a peer resumes its own session (by id, and that session is related to the same endpoint as the peer), no verify request is used. If a peer resumes as session (by id), but a different session is related to its endpoint, then a verify request is used to ensure, that the peer really owns that endpoint. If a peer resumes a session, and the endpoint of the peer is either unused or not related to a established session, this threshold controls, if a verify request is used or not. If more resumption handshakes without verified peers are pending than this threshold, then a verify request is used. Note: a value larger than 0 will call
SessionCache.get(org.eclipse.californium.scandium.dtls.SessionId).
If that implementation is expensive, please ensure, that this value is
configured with 0. Otherwise, CLIENT_HELLOs with invalid session
ids may be spoofed and gets too expensive.
Note: if spoofing is considered to be relevant for the used network
environment, please set this to 0 using
DtlsConnectorConfig.Builder.setVerifyPeersOnResumptionThreshold(int) in order to
disable this function.getMaxConnections().public ConnectionIdGenerator getConnectionIdGenerator()
null for not supported. The
returned generator may only support the use of a connection id
without using it by itself. In that case
ConnectionIdGenerator.useConnectionId() will return
false.public Integer getOutboundMessageBufferSize()
public InetSocketAddress getAddress()
public List<X509Certificate> getCertificateChain()
null if the connector is
not supposed to support certificate based authenticationpublic CipherSuiteSelector getCipherSuiteSelector()
DefaultCipherSuiteSelector.public List<CipherSuite> getPreselectedCipherSuites()
CipherSuite to be automatically selected as supported cipher
suites depending on other setting (e.g. if settings allow only PSK, only
PSK compatible cipher suite from this list will be selected).
Not used, if supported cipher suites are provided.getSupportedCipherSuites()public List<CipherSuite> getSupportedCipherSuites()
public List<SignatureAndHashAlgorithm> getSupportedSignatureAlgorithms()
SignatureAndHashAlgorithm.DEFAULT as list of
supported signature and hash algorithmspublic List<XECDHECryptography.SupportedGroup> getSupportedGroups()
public PrivateKey getPrivateKey()
@Deprecated public PskStore getPskStore()
getAdvancedPskStore() insteadnull, if a advanced psk store is
provided to the builder.public AdvancedPskStore getAdvancedPskStore()
PskStore is provided to the builder using
DtlsConnectorConfig.Builder.setPskStore(PskStore), a AdvancedInMemoryPskStore
is returned using that psk store after DtlsConnectorConfig.Builder.build() is called.public PublicKey getPublicKey()
public X509Certificate[] getTrustStore()
DtlsConnectorConfig.Builder.setTrustStore(Certificate[]) is used.
Note: the upcoming next major version 3.0 will remove this method.null, the trust may be
implemented by a CertificateVerifier.public CertificateVerifier getCertificateVerifier()
public NewAdvancedCertificateVerifier getAdvancedCertificateVerifier()
public ApplicationLevelInfoSupplier getApplicationLevelInfoSupplier()
null if not setpublic Boolean isClientAuthenticationWanted()
true if clients wanted to authenticatepublic Boolean isClientAuthenticationRequired()
true if clients need to authenticatepublic Boolean isServerOnly()
true if the connector acts only as serverpublic String getDefaultHandshakeMode()
DtlsEndpointContext.KEY_HANDSHAKE_MODE.DtlsEndpointContext.HANDSHAKE_MODE_NONE or
DtlsEndpointContext.HANDSHAKE_MODE_AUTO (default)public List<CertificateType> getIdentityCertificateTypes()
null, if no
certificates are used to identify this peer.public List<CertificateType> getTrustCertificateTypes()
null, if no
certificates are used to trust the other peer.public Integer getMaxConnections()
Once this limit is reached, new connections will only be accepted if stale connections exist. A stale connection is one that hasn't been used for at least staleConnectionThreshold seconds.
getStaleConnectionThreshold()public Long getStaleConnectionThreshold()
Once a connection becomes stale, it cannot be used to transfer DTLS records anymore.
getMaxConnections()public Integer getConnectionThreadCount()
The default value is 6 * #(CPU cores).
public Integer getReceiverThreadCount()
The default value is half of #(CPU cores).
public Integer getSocketReceiveBufferSize()
null, to use the OS default.public Integer getSocketSendBufferSize()
null, to use the OS default.public Long getAutoResumptionTimeoutMillis()
DtlsEndpointContext.KEY_RESUMPTION_TIMEOUT.null, if no automatic
resumption is intended.public Boolean useNoServerSessionId()
true if no session id is used by this server.public Boolean useAntiReplayFilter()
true, apply anti replay filter@Deprecated public Boolean useWindowFilter()
useExtendedWindowFilter() instead.true, apply window filterpublic Integer useExtendedWindowFilter()
-1 will set that calculated lower boundary to 0.
Messages between lower receive window boundary and that calculated value
will pass the filter, for other messages the filter is applied.-1, to
extend lower boundary to 0, 0 to disable extended
window filter.public Boolean useCidUpdateAddressOnNewerRecordFilter()
true, apply the newer filterpublic TrustedRpkStore getRpkTrustStore()
public Boolean useHandshakeStateValidation()
true, if handshake state validation is usedpublic Boolean useKeyUsageVerification()
true, if check of key usage (x509 extension) is enabledpublic Boolean useTruncatedCertificatePathForClientsCertificateMessage()
CertificateRequest for the client's
CertificateMessage.true, if path should be truncated for client's
certificate message.public Boolean useTruncatedCertificatePathForValidation()
true, if path should be truncated at available trust
anchors for validationpublic ConnectionListener getConnectionListener()
public String getLoggingTag()
public Integer getHealthStatusInterval()
public DtlsHealth getHealthHandler()
public Boolean isClientOnly()
true if the connector acts only as clientDtlsConnectorConfig.Builder.setClientOnly()public Boolean isRecommendedCipherSuitesOnly()
true if only recommended cipher suites are used.DtlsConnectorConfig.Builder.setRecommendedCipherSuitesOnly(boolean)public Boolean isRecommendedSupportedGroupsOnly()
true if only recommended supported groups (curves) are used.DtlsConnectorConfig.Builder.setRecommendedSupportedGroupsOnly(boolean)protected Object clone()
public static DtlsConnectorConfig.Builder builder()
public static DtlsConnectorConfig.Builder builder(DtlsConnectorConfig config)
config - DtlsConnectorConfig to cloneCopyright © 2023 Eclipse Foundation. All rights reserved.