public class TlsTrustManager extends Object implements X509TrustManager
TlsTrustManager
verifies the trust for clients and servers connected based on the certificates, and
fingerprints provided.Constructor and Description |
---|
TlsTrustManager(X509TrustManager trustManager,
boolean useClientMode,
TransportStateReference tmStateReference,
CounterSupport tlstmCounters,
TlsTmSecurityCallback<X509Certificate> securityCallback)
Creates a new
TlsTrustManager . |
Modifier and Type | Method and Description |
---|---|
void |
checkClientTrusted(X509Certificate[] x509Certificates,
String s) |
void |
checkServerTrusted(X509Certificate[] x509Certificates,
String s) |
X509Certificate[] |
getAcceptedIssuers() |
static X509Certificate[] |
getAcceptedIssuers(X509TrustManager trustManager,
TlsTmSecurityCallback<X509Certificate> securityCallback)
Gets the accepted
X509Certificate s from the given X509TrustManager and security callback. |
protected TlsTmSecurityCallback<X509Certificate> |
getSecurityCallback() |
public TlsTrustManager(X509TrustManager trustManager, boolean useClientMode, TransportStateReference tmStateReference, CounterSupport tlstmCounters, TlsTmSecurityCallback<X509Certificate> securityCallback)
TlsTrustManager
.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
- the TransportStateReference
that optionally contains a TlsTmSecurityCallback
which will
then take precedence over the TlsTmSecurityCallback
provided as parameter (which could then be
null
).tlstmCounters
- the CounterSupport
for recording events created by this trust manager.securityCallback
- the TlsTmSecurityCallback
to be used (if tmStateReference
does not provide some) to
validate peers.public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
checkClientTrusted
in interface X509TrustManager
CertificateException
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
checkServerTrusted
in interface X509TrustManager
CertificateException
public X509Certificate[] getAcceptedIssuers()
getAcceptedIssuers
in interface X509TrustManager
public static X509Certificate[] getAcceptedIssuers(X509TrustManager trustManager, TlsTmSecurityCallback<X509Certificate> securityCallback)
X509Certificate
s from the given X509TrustManager
and security callback.trustManager
- a X509TrustManager providing the accepted issuers.securityCallback
- a security callback that is ask to accept any returned issuer.null
array of accepted issuers.protected TlsTmSecurityCallback<X509Certificate> getSecurityCallback()
Copyright © 2020 SNMP4J.org. All rights reserved.