org.jsslutils.sslcontext.trustmanagers
Class TrustAllClientsWrappingTrustManager

java.lang.Object
  extended by org.jsslutils.sslcontext.trustmanagers.TrustAllClientsWrappingTrustManager
All Implemented Interfaces:
TrustManager, X509TrustManager

public class TrustAllClientsWrappingTrustManager
extends Object
implements X509TrustManager

TrustManager that accepts all client certificates as trusted.

Author:
Bruno Harbulot.

Nested Class Summary
static class TrustAllClientsWrappingTrustManager.Wrapper
          Wrapper factory class that wraps existing X509TrustManagers into X509TrustManagers that trust any clients.
 
Constructor Summary
TrustAllClientsWrappingTrustManager(X509TrustManager trustManager)
          Creates a new instance from an existing X509TrustManager.
 
Method Summary
 void checkClientTrusted(X509Certificate[] chain, String authType)
          Checks that the client is trusted; in this case, it accepts anything.
 void checkServerTrusted(X509Certificate[] chain, String authType)
          Checks that the server is trusted; in this case, it delegates this check to the trust manager it wraps.
 X509Certificate[] getAcceptedIssuers()
          Returns the accepted issuers; in this case, it's an empty array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrustAllClientsWrappingTrustManager

public TrustAllClientsWrappingTrustManager(X509TrustManager trustManager)
Creates a new instance from an existing X509TrustManager.

Parameters:
trustManager - X509TrustManager to wrap.
Method Detail

checkClientTrusted

public void checkClientTrusted(X509Certificate[] chain,
                               String authType)
                        throws CertificateException
Checks that the client is trusted; in this case, it accepts anything.

Specified by:
checkClientTrusted in interface X509TrustManager
Throws:
CertificateException

checkServerTrusted

public void checkServerTrusted(X509Certificate[] chain,
                               String authType)
                        throws CertificateException
Checks that the server is trusted; in this case, it delegates this check to the trust manager it wraps.

Specified by:
checkServerTrusted in interface X509TrustManager
Throws:
CertificateException

getAcceptedIssuers

public X509Certificate[] getAcceptedIssuers()
Returns the accepted issuers; in this case, it's an empty array.

Specified by:
getAcceptedIssuers in interface X509TrustManager


Copyright © 2012. All Rights Reserved.