Package org.snmp4j.transport.tls
Class TlsTrustManager
java.lang.Object
org.snmp4j.transport.tls.TlsTrustManager
- All Implemented Interfaces:
TrustManager,X509TrustManager
The
TlsTrustManager verifies the trust for clients and servers connected based on the certificates, and
fingerprints provided.- Version:
- 3.3.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionTlsTrustManager(X509TrustManager trustManager, boolean useClientMode, TransportStateReference tmStateReference, CounterSupport tlstmCounters, TlsTmSecurityCallback<X509Certificate> securityCallback) Creates a newTlsTrustManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClientTrusted(X509Certificate[] x509Certificates, String s) voidcheckServerTrusted(X509Certificate[] x509Certificates, String s) static X509Certificate[]getAcceptedIssuers(X509TrustManager trustManager, TlsTmSecurityCallback<X509Certificate> securityCallback) Gets the acceptedX509Certificates from the givenX509TrustManagerand security callback.protected TlsTmSecurityCallback<X509Certificate>
-
Constructor Details
-
TlsTrustManager
public TlsTrustManager(X509TrustManager trustManager, boolean useClientMode, TransportStateReference tmStateReference, CounterSupport tlstmCounters, TlsTmSecurityCallback<X509Certificate> securityCallback) Creates a newTlsTrustManager.- Parameters:
trustManager- the X509 trust manager to be used to validate certificates.useClientMode- determines if the trust is established as client (true) or server (false).tmStateReference- theTransportStateReferencethat optionally contains aTlsTmSecurityCallbackwhich will then take precedence over theTlsTmSecurityCallbackprovided as parameter (which could then benull).tlstmCounters- theCounterSupportfor recording events created by this trust manager.securityCallback- theTlsTmSecurityCallbackto be used (iftmStateReferencedoes not provide some) to validate peers.
-
-
Method Details
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException - Specified by:
checkClientTrustedin interfaceX509TrustManager- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException - Specified by:
checkServerTrustedin interfaceX509TrustManager- Throws:
CertificateException
-
getAcceptedIssuers
- Specified by:
getAcceptedIssuersin interfaceX509TrustManager
-
getAcceptedIssuers
public static X509Certificate[] getAcceptedIssuers(X509TrustManager trustManager, TlsTmSecurityCallback<X509Certificate> securityCallback) Gets the acceptedX509Certificates from the givenX509TrustManagerand security callback.- Parameters:
trustManager- a X509TrustManager providing the accepted issuers.securityCallback- a security callback that is ask to accept any returned issuer.- Returns:
- a probably empty or
nullarray of accepted issuers. - Since:
- 3.1.1
-
getSecurityCallback
-