Package com.verisign.epp.transport
Class EPPTrustManager
java.lang.Object
com.verisign.epp.transport.EPPTrustManager
- All Implemented Interfaces:
TrustManager,X509TrustManager
Custom
X509TrustManager for EPP that supports configuring the policy
for the client and server certificate EKU settings with the
setClientEKUs(List) and setServerEKUs(List),
respectively. Once initialized, the EPPTrustManager is thread-safe,
so it can be embedded into a Singleton.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.EPPTrustManager(KeyStore aKeyStore) Creates theEPPTrustManagerinstance with a specific Trust Store.Creates theEPPTrustManagerinstance with a specific Trust Store.EPPTrustManager(Set<X509Certificate> aTrustedCertificates) Creates theEPPTrustManagerinstance with a specificCollectionof trusted certificates.EPPTrustManager(Set<X509Certificate> aTrustedCertificates, List<String> aClientEKUs, List<String> aServerEKUs) Creates theEPPTrustManagerinstance with a specificCollectionof trusted certificates. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClientTrusted(X509Certificate[] aChain, String aAuthType) Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for client SSL authentication based on the authentication type.voidcheckServerTrusted(X509Certificate[] aChain, String aAuthType) Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for server SSL authentication based on the authentication type.Return an array of certificate authority certificates which are trusted for authenticating peers.Gets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the client certificate.Gets the PKIX parameters template that can be cloned and customized, but it must be synchronized since its not thread safe.Gets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the server certificate.Gets the list of trust anchors, which should match the trusted certificates.Gets the list of trusted certificates.Gets the map of trusted principals and their associated public keys.voidInitialize theEPPTrustManagerinstance with a specific Trust Store.voidInitialize theEPPTrustManagerinstance with a specific Trust Store.voidinit(Set<X509Certificate> aTrustedCertificates) Initialize theEPPTrustManagerinstance with a specificCollectionof trusted certificates.voidInitialize theEPPTrustManagerinstance with a specificCollectionof trusted certificates.voidsetClientEKUs(List<String> aClientEKUs) Sets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the client certificate.voidsetServerEKUs(List<String> aServerEKUs) Sets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the server certificate.
-
Constructor Details
-
EPPTrustManager
public EPPTrustManager()Default constructor. Ensure to call one of theinitmethods. -
EPPTrustManager
Creates theEPPTrustManagerinstance with a specific Trust Store. Passing anullTrust Store will load the default Trust Store for the JDK (${JAVA_HOME}/lib/security/cacerts).- Parameters:
aKeyStore- Trust store to initialize theEPPTrustManagerwith. Set tonullto use the default JDK trust store (${JAVA_HOME}/lib/security/cacerts).- Throws:
Exception- Error initializing theEPPTrustManager
-
EPPTrustManager
Creates theEPPTrustManagerinstance with a specificCollectionof trusted certificates.- Parameters:
aTrustedCertificates-Collectionof trusted certificates
-
EPPTrustManager
public EPPTrustManager(KeyStore aKeyStore, List<String> aClientEKUs, List<String> aServerEKUs) throws Exception Creates theEPPTrustManagerinstance with a specific Trust Store. Passing anullTrust Store will load the default Trust Store for the JDK (${JAVA_HOME}/lib/security/cacerts).- Parameters:
aKeyStore- Trust store to initialize theEPPTrustManagerwith. Set tonullto use the default JDK trust store (${JAVA_HOME}/lib/security/cacerts).aClientEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the client certificateaServerEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the server certificate- Throws:
Exception- Error initializing theEPPTrustManager
-
EPPTrustManager
public EPPTrustManager(Set<X509Certificate> aTrustedCertificates, List<String> aClientEKUs, List<String> aServerEKUs) throws Exception Creates theEPPTrustManagerinstance with a specificCollectionof trusted certificates.- Parameters:
aTrustedCertificates-Collectionof trusted certificatesaClientEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the client certificateaServerEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the server certificate- Throws:
Exception- Error initializing theEPPTrustManager
-
-
Method Details
-
init
Initialize theEPPTrustManagerinstance with a specific Trust Store. Passing anullTrust Store will load the default Trust Store for the JDK (${JAVA_HOME}/lib/security/cacerts).- Parameters:
aKeyStore- Trust store to initialize theEPPTrustManagerwith. Set tonullto use the default JDK trust store (${JAVA_HOME}/lib/security/cacerts).- Throws:
Exception- Error initializing theEPPTrustManager
-
init
public void init(KeyStore aKeyStore, List<String> aClientEKUs, List<String> aServerEKUs) throws Exception Initialize theEPPTrustManagerinstance with a specific Trust Store. Passing anullTrust Store will load the default Trust Store for the JDK (${JAVA_HOME}/lib/security/cacerts).- Parameters:
aKeyStore- Trust store to initialize theEPPTrustManagerwith. Set tonullto use the default JDK trust store (${JAVA_HOME}/lib/security/cacerts).aClientEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the client certificateaServerEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the server certificate- Throws:
Exception- Error initializing theEPPTrustManager
-
init
Initialize theEPPTrustManagerinstance with a specificCollectionof trusted certificates.- Parameters:
aTrustedCertificates-Collectionof trusted certificates- Throws:
Exception- Error initializing theEPPTrustManager
-
init
public void init(Set<X509Certificate> aTrustedCertificates, List<String> aClientEKUs, List<String> aServerEKUs) throws Exception Initialize theEPPTrustManagerinstance with a specificCollectionof trusted certificates.- Parameters:
aTrustedCertificates-Collectionof trusted certificatesaClientEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the client certificateaServerEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension for the server certificate- Throws:
Exception- Error initializing theEPPTrustManager
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] aChain, String aAuthType) throws CertificateException Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for client SSL authentication based on the authentication type. The authentication type is determined by the actual certificate used. For instance, if RSAPublicKey is used, the authType should be "RSA". Checking is case-sensitive.
This implementation will only perform PKIX validation and will not validation the Extended Key Usage (EKU) settings.- Specified by:
checkClientTrustedin interfaceX509TrustManager- Parameters:
aChain- the peer certificate chainaAuthType- the authentication type based on the client certificate- Throws:
CertificateException- if the certificate chain is not trusted by this TrustManager.
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] aChain, String aAuthType) throws CertificateException Given the partial or complete certificate chain provided by the peer, build a certificate path to a trusted root and return if it can be validated and is trusted for server SSL authentication based on the authentication type. The authentication type is the key exchange algorithm portion of the cipher suites represented as a String, such as "RSA", "DHE_DSS". Note: for some exportable cipher suites, the key exchange algorithm is determined at run time during the handshake. For instance, for TLS_RSA_EXPORT_WITH_RC4_40_MD5, the authType should be RSA_EXPORT when an ephemeral RSA key is used for the key exchange, and RSA when the key from the server certificate is used. Checking is case-sensitive.- Specified by:
checkServerTrustedin interfaceX509TrustManager- Parameters:
aChain- the peer certificate chainaAuthType- the key exchange algorithm used- Throws:
CertificateException- if the certificate chain is not trusted by this TrustManager.
-
getAcceptedIssuers
Return an array of certificate authority certificates which are trusted for authenticating peers.- Specified by:
getAcceptedIssuersin interfaceX509TrustManager- Returns:
- a non-null (possibly empty) array of acceptable CA issuer certificates.
-
getTrustedCerts
Gets the list of trusted certificates.- Returns:
- the trusted certificates
-
getTrustAnchors
Gets the list of trust anchors, which should match the trusted certificates.- Returns:
- the trust anchors
-
getPkixParamsTemplate
Gets the PKIX parameters template that can be cloned and customized, but it must be synchronized since its not thread safe.- Returns:
- the PKIX parameters template
-
getTrustedSubjects
Gets the map of trusted principals and their associated public keys.- Returns:
- Map of the trusted principals and their associated public keys
-
getClientEKUs
Gets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the client certificate. Anullvalue means that the EKU values in the client certificate will be ignored. These values are The values are integer values, as defined in the PKIX Extended Key Purpose registry.- Returns:
- the trust client EKU values or
nullto ignore the EKU settings
-
setClientEKUs
Sets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the client certificate. Anullvalue means that the EKU values in the client certificate will be ignored. These values are The values are integer values, as defined in the PKIX Extended Key Purpose registry.- Parameters:
aClientEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension
-
getServerEKUs
Gets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the server certificate. Anullvalue means that the EKU values in the server certificate will be ignored. These values are The values are integer values, as defined in the PKIX Extended Key Purpose registry.- Returns:
- the trust server EKU values or
nullto ignore the EKU settings
-
setServerEKUs
Sets the list of trusted X.509 Extended Key Usage (EKU) values, where at least one of the values must exist in the server certificate. Anullvalue means that the EKU values in the server certificate will be ignored. These values are The values are integer values, as defined in the PKIX Extended Key Purpose registry.- Parameters:
aServerEKUs- Set to a list of EKU Object Identifier (OID) values ornullto ignore the EKU extension
-