Class DefaultSSLEngineConfiguration
java.lang.Object
org.snmp4j.transport.tls.DefaultSSLEngineConfiguration
- All Implemented Interfaces:
SSLEngineConfigurator
The
DefaultSSLEngineConfiguration implements the SSL engine configuration based on
X509Certificate trust management.- Since:
- 3.6.0
- Author:
- Frank Fock
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe endpoint identification algorithm used for client mode SSL engines by default, which makes JSSE verify that the certificate of the (D)TLS server matches the host name or IP address of the target as required by RFC 6353 §5.3.1. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSSLEngineConfiguration(X509TlsTransportMappingConfig tlsTransportMappingConfig, TLSTMTrustManagerFactory trustManagerFactory, String defaultProtocolVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigure the supplied SSLEngine for TLS.voidconfigure(SSLEngine sslEngine, TransportStateReference tmStateReference) Configure the supplied SSLEngine for TLS on behalf of the given transport state reference, which provides the target of the connection and thus its expected identity and certificate fingerprints.Gets the endpoint identification algorithm applied to client mode SSL engines.getSSLContext(boolean useClientMode, TransportStateReference transportStateReference) Gets the SSLContext for this SSL connection.booleanIndicates whether an accepted (D)TLS client has to authenticate itself with a certificate.voidsetClientAuthenticationRequired(boolean clientAuthenticationRequired) Sets whether an accepted (D)TLS client has to authenticate itself with a certificate.voidsetEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm) Sets the endpoint identification algorithm applied to client mode SSL engines.
-
Field Details
-
DEFAULT_ENDPOINT_IDENTIFICATION_ALGORITHM
The endpoint identification algorithm used for client mode SSL engines by default, which makes JSSE verify that the certificate of the (D)TLS server matches the host name or IP address of the target as required by RFC 6353 §5.3.1.- Since:
- 3.13.0
- See Also:
-
-
Constructor Details
-
DefaultSSLEngineConfiguration
public DefaultSSLEngineConfiguration(X509TlsTransportMappingConfig tlsTransportMappingConfig, TLSTMTrustManagerFactory trustManagerFactory, String defaultProtocolVersion)
-
-
Method Details
-
getDefaultProtocolVersion
-
getTlsTransportMappingConfig
-
getTrustManagerFactory
-
isClientAuthenticationRequired
public boolean isClientAuthenticationRequired()Indicates whether an accepted (D)TLS client has to authenticate itself with a certificate.- Returns:
trueif client authentication is required, which is the default as mandated by RFC 6353 §5.3.2.- Since:
- 3.13.0
-
setClientAuthenticationRequired
public void setClientAuthenticationRequired(boolean clientAuthenticationRequired) Sets whether an accepted (D)TLS client has to authenticate itself with a certificate. RFC 6353 §5.3.2 requires that the server "MUST request and expect a certificate from the client and MUST NOT accept SNMP messages over the (D)TLS connection until the client has sent a certificate and it has been authenticated". Setting this tofalserestores the pre 3.13.0 behavior where a client that sent no certificate could complete the handshake.- Parameters:
clientAuthenticationRequired-falseto make client authentication optional.- Since:
- 3.13.0
-
getEndpointIdentificationAlgorithm
Gets the endpoint identification algorithm applied to client mode SSL engines.- Returns:
- the endpoint identification algorithm or
nullif no endpoint identification is performed by JSSE. The default isDEFAULT_ENDPOINT_IDENTIFICATION_ALGORITHM. - Since:
- 3.13.0
-
setEndpointIdentificationAlgorithm
Sets the endpoint identification algorithm applied to client mode SSL engines. Set this tonullto disable JSSE based endpoint identification, for example for fingerprint pinned targets whose device certificates do not contain a matching subject alternative name.- Parameters:
endpointIdentificationAlgorithm- the endpoint identification algorithm, for example"HTTPS", ornull.- Since:
- 3.13.0
-
configure
Description copied from interface:SSLEngineConfiguratorConfigure the supplied SSLEngine for TLS on behalf of the given transport state reference, which provides the target of the connection and thus its expected identity and certificate fingerprints. The default implementation ignores the transport state reference and callsSSLEngineConfigurator.configure(SSLEngine).- Specified by:
configurein interfaceSSLEngineConfigurator- Parameters:
sslEngine- aSSLEngineto configure.tmStateReference- the transport state reference of the connection to configure, ornullfor an accepted connection.
-
configure
Description copied from interface:SSLEngineConfiguratorConfigure the supplied SSLEngine for TLS. Configuration includes enabled protocol(s), cipher codes, etc.- Specified by:
configurein interfaceSSLEngineConfigurator- Parameters:
sslEngine- aSSLEngineto configure.
-
getSSLContext
public SSLContext getSSLContext(boolean useClientMode, TransportStateReference transportStateReference) throws GeneralSecurityException Description copied from interface:SSLEngineConfiguratorGets the SSLContext for this SSL connection.- Specified by:
getSSLContextin interfaceSSLEngineConfigurator- Parameters:
useClientMode-trueif the connection is established in client mode.transportStateReference- the transportStateReference with additional security information for the SSL connection to establish.- Returns:
- the SSLContext.
- Throws:
GeneralSecurityException- if the TLS context initialization failed because of configuration errors.
-