p2ps.imp.peer
Class DefaultTrustManager
java.lang.Object
p2ps.imp.peer.DefaultTrustManager
- All Implemented Interfaces:
- TrustManager
- public class DefaultTrustManager
- extends java.lang.Object
- implements TrustManager
- Version:
- $Revision: 295 $
- Author:
- Ian Wang
|
Constructor Summary |
DefaultTrustManager(boolean identity,
boolean trust,
boolean authorization)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultTrustManager
public DefaultTrustManager(boolean identity,
boolean trust,
boolean authorization)
- Parameters:
identity - true if check identity of client/servertrust - true if check trust of client/server
acceptClientCertificate
public void acceptClientCertificate(SecurityContext peercontext,
SecurityContext remotecontext,
java.security.cert.X509Certificate[] chain,
java.lang.String authtype,
javax.net.ssl.X509TrustManager deftrustman)
throws java.security.cert.CertificateException
- Check whether a client certificate should be accepted.
- Specified by:
acceptClientCertificate in interface TrustManager
- Parameters:
peercontext - the context for the local peer (server)remotecontext - the context for the remote entity (client), or null if unknownchain - the certificate chain received from the clientauthtype - the authorization type for the certificate (e.g. RSA)deftrustman - the default system trust manager
- Throws:
java.security.cert.CertificateException - if the certificate is not accepted
acceptServerCertificate
public void acceptServerCertificate(SecurityContext peercontext,
SecurityContext remotecontext,
java.security.cert.X509Certificate[] chain,
java.lang.String authtype,
javax.net.ssl.X509TrustManager deftrustman)
throws java.security.cert.CertificateException
- Check whether a server certificate should be accepted.
- Specified by:
acceptServerCertificate in interface TrustManager
- Parameters:
peercontext - the context for the local peer (client)remotecontext - the context for the remote entity (server), or null if unknownchain - the certificate chain received from the clientauthtype - the authorization type for the certificate (e.g. RSA)deftrustman - the default system trust manager
- Throws:
java.security.cert.CertificateException - if the certificate is not accepted
getCertificateThumbprint
public static java.lang.String getCertificateThumbprint(java.security.cert.X509Certificate cert)
throws java.security.cert.CertificateEncodingException,
java.security.NoSuchAlgorithmException
- Returns:
- the certificate thumbprint for the specified certificate
- Throws:
java.security.cert.CertificateEncodingException
java.security.NoSuchAlgorithmException