public class InteractiveTrustManager extends Object implements X509TrustManager, CallbackHandler
X509TrustManager which can operate
in different modes. If mode is NONE, then any server certificate is
accepted and no certificate-based client authentication is performed. If mode
is SERVER, then server certificates are verified and if verification is
unsuccessful, a dialog is presented to the user, which allows accepting a
certificate temporarily or permanently. If mode is CLIENT, then
certificate-based client authentication is performed. Finally, there is a
mode STRICT, which combines both SERVER and CLIENT modes.| Modifier and Type | Field and Description |
|---|---|
static int |
CLIENT
Mode for using client certificates.
|
static int |
NONE
Mode for accepting any certificate.
|
static int |
SERVER
Mode for verifying server certificate chains.
|
static int |
STRICT
Mode for performing both client authentication and server cert
verification.
|
| Constructor and Description |
|---|
InteractiveTrustManager(UploadPolicy p,
String hostname,
String passwd)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkClientTrusted(X509Certificate[] arg0,
String arg1)
As this class is used on the client side only, The implementation of this
method does nothing.
|
void |
checkServerTrusted(X509Certificate[] chain,
String authType) |
X509Certificate[] |
getAcceptedIssuers() |
KeyManager[] |
getKeyManagers()
Retrieve key managers.
|
X509TrustManager[] |
getTrustManagers()
Retrieve trust managers.
|
void |
handle(Callback[] callbacks) |
public static final int NONE
public static final int SERVER
public static final int CLIENT
public static final int STRICT
public InteractiveTrustManager(UploadPolicy p, String hostname, String passwd) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IllegalArgumentException, UnrecoverableKeyException
p - The UploadPolicy to use for this instance.hostname - passwd - An optional password for the truststore.NoSuchAlgorithmExceptionKeyStoreExceptionCertificateExceptionIllegalArgumentExceptionUnrecoverableKeyExceptionpublic void handle(Callback[] callbacks) throws UnsupportedCallbackException
handle in interface CallbackHandlerUnsupportedCallbackExceptionCallbackHandler.handle(javax.security.auth.callback.Callback[])public KeyManager[] getKeyManagers()
public X509TrustManager[] getTrustManagers()
public void checkClientTrusted(X509Certificate[] arg0, String arg1)
checkClientTrusted in interface X509TrustManagerX509TrustManager.checkClientTrusted(java.security.cert.X509Certificate[],
java.lang.String)public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkServerTrusted in interface X509TrustManagerCertificateExceptionX509TrustManager.checkServerTrusted(java.security.cert.X509Certificate[],
java.lang.String)public X509Certificate[] getAcceptedIssuers()
getAcceptedIssuers in interface X509TrustManagerX509TrustManager.getAcceptedIssuers()Copyright © 2015. All rights reserved.