ZXTM Control API Overview and Reference
Version 4.0
}
/* The following code disables certificate checking.
* Use the Security.addProvider and Security.setProperty
* calls to enable it */
public static class MyProvider extends Provider {
public MyProvider() {
super( "MyProvider", 1.0, "Trust certificates" );
put( "TrustManagerFactory.TrustAllCertificates",
MyTrustManagerFactory.class.getName() );
}
protected static class MyTrustManagerFactory
extends TrustManagerFactorySpi {
public MyTrustManagerFactory() {}
protected void engineInit( KeyStore keystore ) {}
protected void engineInit(
ManagerFactoryParameters mgrparams ) {}
protected TrustManager[] engineGetTrustManagers() {
return new TrustManager[] {
new MyX509TrustManager()
};
}
}
protected static class MyX509TrustManager
implements X509TrustManager {
public void checkClientTrusted(
X509Certificate[] chain, String authType) {}
public void checkServerTrusted(
X509Certificate[] chain, String authType) {}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
}
}
}
The bulk of this code disables client certificate checking. Details of the
code and surrounding infrastructure are at:
http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html
24
New Page 1