Package edu.uiuc.ncsa.security.util.ssl
Class VerifyingHTTPClientFactory.X509TrustManagerFacade
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.ssl.VerifyingHTTPClientFactory.X509TrustManagerFacade
-
- All Implemented Interfaces:
TrustManager
,X509TrustManager
- Enclosing class:
- VerifyingHTTPClientFactory
public static class VerifyingHTTPClientFactory.X509TrustManagerFacade extends Object implements X509TrustManager
A facade for trust managers. The SSLContext will accept arrays of trust managers, but only the first is actually ever used. This facade will check each registered trust manager and fail only if all attempts fail.
-
-
Constructor Summary
Constructors Constructor Description X509TrustManagerFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(X509TrustManager x509TrustManager)
Convenience method.void
checkClientTrusted(X509Certificate[] x509Certificates, String s)
void
checkServerTrusted(X509Certificate[] x509Certificates, String s)
Annoyingly, javax's SSL catches exceptions, but does not propagate them, so many trust managers explicitly print out their stack traces.X509Certificate[]
getAcceptedIssuers()
This gets all of them from all trust managers.List<X509TrustManager>
getTrustManagers()
void
setTrustManagers(List<X509TrustManager> trustManagers)
-
-
-
Method Detail
-
getTrustManagers
public List<X509TrustManager> getTrustManagers()
-
setTrustManagers
public void setTrustManagers(List<X509TrustManager> trustManagers)
-
add
public void add(X509TrustManager x509TrustManager)
Convenience method. Adds a trust manager.- Parameters:
x509TrustManager
-
-
checkClientTrusted
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
- Specified by:
checkClientTrusted
in interfaceX509TrustManager
- Throws:
CertificateException
-
checkServerTrusted
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException
Annoyingly, javax's SSL catches exceptions, but does not propagate them, so many trust managers explicitly print out their stack traces. We need catch them anyway but then discard the output or we might double the number of benign error messages- Specified by:
checkServerTrusted
in interfaceX509TrustManager
- Parameters:
x509Certificates
-s
-- Throws:
CertificateException
-
getAcceptedIssuers
public X509Certificate[] getAcceptedIssuers()
This gets all of them from all trust managers. It would actually be fine if it returned an empty array too, since it is never used (all calls are really delegated to each trust manager.- Specified by:
getAcceptedIssuers
in interfaceX509TrustManager
- Returns:
-
-