org.glite.slcs.httpclient.ssl
Class ExtendedX509TrustManager

java.lang.Object
  extended by org.glite.slcs.httpclient.ssl.ExtendedX509TrustManager
All Implemented Interfaces:
javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager

public class ExtendedX509TrustManager
extends java.lang.Object
implements javax.net.ssl.X509TrustManager

ExtendedTrustX509TrustManager can be used to extend the default JSSE X509TrustManager with additional trusted CAs stored in a trust store.

Version:
$Revision: 1.6 $
Author:
Valery Tschoppp

Constructor Summary
ExtendedX509TrustManager(java.security.KeyStore trustStore, javax.net.ssl.X509TrustManager defaultTrustManager)
          Constructor for ExtendedX509TrustManager.
 
Method Summary
 void checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
           
 void checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
           
protected static java.util.List createTrustedIssuers(java.security.KeyStore truststore)
           
 java.security.cert.X509Certificate[] getAcceptedIssuers()
          Merges the system wide accepted issuers and the own ones and returns them.
protected  boolean isCertificateIssuerTrusted(java.security.cert.X509Certificate cert)
          Returns true iff the certificate issuer is in our trust store and it have signed the cert.
protected  boolean isCertificateTrusted(java.security.cert.X509Certificate cert)
          Checks if the certificate is store in our trust store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedX509TrustManager

public ExtendedX509TrustManager(java.security.KeyStore trustStore,
                                javax.net.ssl.X509TrustManager defaultTrustManager)
                         throws java.security.KeyStoreException
Constructor for ExtendedX509TrustManager.

Parameters:
truststore - The trust KeyStore containing the additional trusted CA.
defaultTrustManager - The default JSSE X509TrustManager
Throws:
java.security.KeyStoreException
Method Detail

createTrustedIssuers

protected static java.util.List createTrustedIssuers(java.security.KeyStore truststore)
                                              throws java.security.KeyStoreException
Throws:
java.security.KeyStoreException

checkClientTrusted

public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
                               java.lang.String authType)
                        throws java.security.cert.CertificateException
Specified by:
checkClientTrusted in interface javax.net.ssl.X509TrustManager
Throws:
java.security.cert.CertificateException
See Also:
X509TrustManager.checkClientTrusted(X509Certificate[],String authType)

checkServerTrusted

public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
                               java.lang.String authType)
                        throws java.security.cert.CertificateException
Specified by:
checkServerTrusted in interface javax.net.ssl.X509TrustManager
Throws:
java.security.cert.CertificateException
See Also:
X509TrustManager.checkServerTrusted(X509Certificate[],String authType)

isCertificateTrusted

protected boolean isCertificateTrusted(java.security.cert.X509Certificate cert)
Checks if the certificate is store in our trust store.

Parameters:
cert - The X509 certificate to check.
Returns:
true if the certificate is in trustedIssuers hashtable as value.

isCertificateIssuerTrusted

protected boolean isCertificateIssuerTrusted(java.security.cert.X509Certificate cert)
Returns true iff the certificate issuer is in our trust store and it have signed the cert.

Parameters:
cert - The X509 certificate to check.
Returns:
true if the certificate issuer is in trustedIssuers list and have signed the cert.

getAcceptedIssuers

public java.security.cert.X509Certificate[] getAcceptedIssuers()
Merges the system wide accepted issuers and the own ones and returns them.

Specified by:
getAcceptedIssuers in interface javax.net.ssl.X509TrustManager
Returns:
Array of X509 certificates of the accepted issuers.
See Also:
X509TrustManager.getAcceptedIssuers()