Package org.snmp4j.transport.tls
Class PropertiesTlsTmSecurityCallback
java.lang.Object
org.snmp4j.transport.tls.PropertiesTlsTmSecurityCallback
- All Implemented Interfaces:
TlsTmSecurityCallback<X509Certificate>
public class PropertiesTlsTmSecurityCallback
extends Object
implements TlsTmSecurityCallback<X509Certificate>
The
PropertiesTlsTmSecurityCallback resolves the
tmSecurityName for incoming requests by using the
(system) properties
org.snmp4j.arg.securityName
org.snmp4j.arg.tlsLocalID
org.snmp4j.arg.tlsTrustCA
org.snmp4j.arg.tlsPeerID- Since:
- 2.0
- Version:
- 3.3.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionPropertiesTlsTmSecurityCallback(boolean serverMode) PropertiesTlsTmSecurityCallback(Properties properties, boolean serverMode) -
Method Summary
Modifier and TypeMethodDescriptiongetLocalCertificateAlias(Address targetAddress) Gets the local certificate alias to be used for the supplied target address.getSecurityName(X509Certificate[] peerCertificateChain) Gets the tmSecurityName (see RFC 5953) from the certificate chain of the communication peer that needs to be authenticated.booleanisAcceptedIssuer(X509Certificate issuerCertificate) Check if the supplied issuer certificate is accepted as server.booleanisClientCertificateAccepted(X509Certificate peerEndCertificate) Check if the supplied peer end certificate is accepted as client.booleanisServerCertificateAccepted(X509Certificate[] peerCertificateChain) Check if the supplied peer certificate chain is accepted as server.
-
Constructor Details
-
PropertiesTlsTmSecurityCallback
public PropertiesTlsTmSecurityCallback(boolean serverMode) -
PropertiesTlsTmSecurityCallback
-
-
Method Details
-
getSecurityName
Description copied from interface:TlsTmSecurityCallbackGets the tmSecurityName (see RFC 5953) from the certificate chain of the communication peer that needs to be authenticated.- Specified by:
getSecurityNamein interfaceTlsTmSecurityCallback<X509Certificate>- Parameters:
peerCertificateChain- an array ofCertificates with the peer's own certificate first followed by any CA authorities.- Returns:
- the tmSecurityName as defined by RFC 5953.
-
isClientCertificateAccepted
public boolean isClientCertificateAccepted(X509Certificate peerEndCertificate) throws CertificateException Description copied from interface:TlsTmSecurityCallbackCheck if the supplied peer end certificate is accepted as client.- Specified by:
isClientCertificateAcceptedin interfaceTlsTmSecurityCallback<X509Certificate>- Parameters:
peerEndCertificate- a client Certificate instance to check acceptance for.- Returns:
trueif the certificate is accepted,falseotherwise, i.e. if verification could not performed, i.e. because it was not configured sufficiently.- Throws:
CertificateException- if the certificate is rejected.
-
isServerCertificateAccepted
public boolean isServerCertificateAccepted(X509Certificate[] peerCertificateChain) throws CertificateException Description copied from interface:TlsTmSecurityCallbackCheck if the supplied peer certificate chain is accepted as server.- Specified by:
isServerCertificateAcceptedin interfaceTlsTmSecurityCallback<X509Certificate>- Parameters:
peerCertificateChain- a server Certificate chain to check acceptance for.- Returns:
trueif the certificate is accepted,falseotherwise, i.e. if verification could not performed, i.e. because it was not configured sufficiently.- Throws:
CertificateException- if the certificate is rejected.
-
isAcceptedIssuer
Description copied from interface:TlsTmSecurityCallbackCheck if the supplied issuer certificate is accepted as server.- Specified by:
isAcceptedIssuerin interfaceTlsTmSecurityCallback<X509Certificate>- Parameters:
issuerCertificate- an issuer Certificate instance to check acceptance for.- Returns:
trueif the certificate is accepted,falseotherwise, i.e. if verification could not performed, i.e. because it was not configured sufficiently.- Throws:
CertificateException- if the certificate is rejected.
-
getLocalCertificateAlias
Description copied from interface:TlsTmSecurityCallbackGets the local certificate alias to be used for the supplied target address.- Specified by:
getLocalCertificateAliasin interfaceTlsTmSecurityCallback<X509Certificate>- Parameters:
targetAddress- a target address ornullif the default local certificate alias needs to be retrieved.- Returns:
- the requested local certificate alias, if known. Otherwise
nullis returned which could cause a protocol violation if the local key store contains more than one certificate.
-