org.wikibooks.en.wiki.WebObjects.Web_Services.How_to_Trust_Any_SSL_Certificate
Class FakeX509TrustManager

java.lang.Object
  extended by org.wikibooks.en.wiki.WebObjects.Web_Services.How_to_Trust_Any_SSL_Certificate.FakeX509TrustManager
All Implemented Interfaces:
javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager

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

This class allow any X509 certificates to be used to authenticate the remote side of a secure socket, including self-signed certificates.

Author:
Francis Labrie

Constructor Summary
FakeX509TrustManager()
           
 
Method Summary
 void checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
          Always trust for client SSL chain peer certificate chain with any authType authentication types.
 void checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
          Always trust for server SSL chain peer certificate chain with any authType exchange algorithm types.
 java.security.cert.X509Certificate[] getAcceptedIssuers()
          Return an empty array of certificate authority certificates which are trusted for authenticating peers.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FakeX509TrustManager

public FakeX509TrustManager()
Method Detail

checkClientTrusted

public void checkClientTrusted(java.security.cert.X509Certificate[] chain,
                               java.lang.String authType)
Always trust for client SSL chain peer certificate chain with any authType authentication types.

Specified by:
checkClientTrusted in interface javax.net.ssl.X509TrustManager
Parameters:
chain - the peer certificate chain.
authType - the authentication type based on the client certificate.

checkServerTrusted

public void checkServerTrusted(java.security.cert.X509Certificate[] chain,
                               java.lang.String authType)
Always trust for server SSL chain peer certificate chain with any authType exchange algorithm types.

Specified by:
checkServerTrusted in interface javax.net.ssl.X509TrustManager
Parameters:
chain - the peer certificate chain.
authType - the key exchange algorithm used.

getAcceptedIssuers

public java.security.cert.X509Certificate[] getAcceptedIssuers()
Return an empty array of certificate authority certificates which are trusted for authenticating peers.

Specified by:
getAcceptedIssuers in interface javax.net.ssl.X509TrustManager
Returns:
a empty array of issuer certificates.