Package org.apache.derby.impl.drda
Class NaiveTrustManager
- java.lang.Object
-
- org.apache.derby.impl.drda.NaiveTrustManager
-
- All Implemented Interfaces:
javax.net.ssl.TrustManager
,javax.net.ssl.X509TrustManager
public class NaiveTrustManager extends java.lang.Object implements javax.net.ssl.X509TrustManager
This is a naive trust manager we use when we don't want server authentication. Any certificate will be accepted.
-
-
Field Summary
Fields Modifier and Type Field Description private static javax.net.ssl.TrustManager[]
thisManager
-
Constructor Summary
Constructors Modifier Constructor Description private
NaiveTrustManager()
We don't want more than one instence of this TrustManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
Checks wether the we trust the client.void
checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType)
Checks wether the we trust the server, which we allways will.java.security.cert.X509Certificate[]
getAcceptedIssuers()
Return an array of certificate authority certificates which are trusted for authenticating peers.static javax.net.SocketFactory
getSocketFactory()
Generate a socket factory with this trust manager.
-
-
-
Method Detail
-
getSocketFactory
public static javax.net.SocketFactory getSocketFactory() throws java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.security.NoSuchProviderException, java.security.KeyStoreException, java.security.UnrecoverableKeyException, java.security.cert.CertificateException, java.io.IOException
Generate a socket factory with this trust manager. Derby Utility routine which is not part of the X509TrustManager interface.- Throws:
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.security.NoSuchProviderException
java.security.KeyStoreException
java.security.UnrecoverableKeyException
java.security.cert.CertificateException
java.io.IOException
-
checkClientTrusted
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType) throws java.security.cert.CertificateException
Checks wether the we trust the client. Since this trust manager is just for the Derby clients, this routine is actually never called, but need to be here when we implement X509TrustManager.- Specified by:
checkClientTrusted
in interfacejavax.net.ssl.X509TrustManager
- Parameters:
chain
- The client's certificate chainauthType
- authorization type (e.g. "RSA" or "DHE_DSS")- Throws:
java.security.cert.CertificateException
-
checkServerTrusted
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, java.lang.String authType) throws java.security.cert.CertificateException
Checks wether the we trust the server, which we allways will.- Specified by:
checkServerTrusted
in interfacejavax.net.ssl.X509TrustManager
- Parameters:
chain
- The server's certificate chainauthType
- authorization type (e.g. "RSA" or "DHE_DSS")- Throws:
java.security.cert.CertificateException
-
getAcceptedIssuers
public java.security.cert.X509Certificate[] getAcceptedIssuers()
Return an array of certificate authority certificates which are trusted for authenticating peers. Not relevant for this trust manager.- Specified by:
getAcceptedIssuers
in interfacejavax.net.ssl.X509TrustManager
-
-