java.lang.Object
org.snmp4j.transport.tls.TLSTMUtil
- Since:
- 3.0
- Version:
- 3.6.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddCRLCertStore(String crlFilePath, PKIXBuilderParameters pkixBuilderParameters) Return the initialization parameters for a TrustManager for doing cert path validation with CRL revocation based on a CRL file.static PKIXRevocationCheckerCreates a default revocation checker with CRL check only (no OCSP) and check is limited to end entity only.static SSLContextcreateSSLContext(String protocol, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword, TransportStateReference transportStateReference, TLSTMTrustManagerFactory trustManagerFactory, boolean useClientMode, TlsTmSecurityCallback<X509Certificate> securityCallback, String localCertificateAlias, PKIXRevocationChecker pkixRevocationChecker, String crlURI) private static voidfilterCertificates(KeyStore ks, TransportStateReference transportStateReference, TlsTmSecurityCallback<X509Certificate> securityCallback, String localCertificateAlias) static OctetStringstatic OctetStringgetIpAddressFromSubjAltName(Collection<List<?>> altNames) static ObjectgetSubjAltName(Collection<List<?>> subjAltNames, int type) private static Collection<? extends CRL> getX509CRLs(String crlUrl) static booleanisMatchingFingerprint(X509Certificate[] x509Certificates, OctetString fingerprint, boolean useClientMode, CounterSupport tlstmCounters, LogAdapter logger, Object eventSource) Checks if any of the certificates in the provided array matches the given fingerprint.
-
Field Details
-
logger
-
MD_SHA_PREFIX_LENGTH
private static final int MD_SHA_PREFIX_LENGTH
-
-
Constructor Details
-
TLSTMUtil
public TLSTMUtil()
-
-
Method Details
-
getFingerprint
-
isMatchingFingerprint
public static boolean isMatchingFingerprint(X509Certificate[] x509Certificates, OctetString fingerprint, boolean useClientMode, CounterSupport tlstmCounters, LogAdapter logger, Object eventSource) throws CertificateException Checks if any of the certificates in the provided array matches the given fingerprint. If the fingerprint to match isnullor zero length,falsewill be returned, because a matching cannot be performed.- Parameters:
x509Certificates- the certificates to match.fingerprint- the searched fingerprintuseClientMode- defines if server or client mode is active to emit the right counter events.tlstmCounters- the counters to increase on matchinglogger- where to logeventSource- the source object for events emitted by the matching.- Returns:
trueif there is a match,falseif matching could not be performed due tonullor zero length fingerprint- Throws:
CertificateException- if there is no matching, but fingerprint is non-null and has a length greater than zero.
-
getSubjAltName
-
getIpAddressFromSubjAltName
-
createSSLContext
public static SSLContext createSSLContext(String protocol, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword, TransportStateReference transportStateReference, TLSTMTrustManagerFactory trustManagerFactory, boolean useClientMode, TlsTmSecurityCallback<X509Certificate> securityCallback, String localCertificateAlias, PKIXRevocationChecker pkixRevocationChecker, String crlURI) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
createDefaultPKIXRevocationChecker
Creates a default revocation checker with CRL check only (no OCSP) and check is limited to end entity only.- Returns:
- a simple revocation checker to be used with
.
invalid reference
#setPKIXRevocationChecker(PKIXRevocationChecker) - Since:
- 3.6.0
-
addCRLCertStore
protected static void addCRLCertStore(String crlFilePath, PKIXBuilderParameters pkixBuilderParameters) Return the initialization parameters for a TrustManager for doing cert path validation with CRL revocation based on a CRL file. Currently, only the defaultPKIXis supported.- Parameters:
crlFilePath- the path to the CRL file that provides the CRL collection for checking revocation.pkixBuilderParameters- thePKIXBuilderParametersto modify.- Since:
- 3.6.0
-
getX509CRLs
-
filterCertificates
private static void filterCertificates(KeyStore ks, TransportStateReference transportStateReference, TlsTmSecurityCallback<X509Certificate> securityCallback, String localCertificateAlias)
-