Package net.sourceforge.jnlp.security
Class VariableX509TrustManager
java.lang.Object
net.sourceforge.jnlp.security.VariableX509TrustManager
This class implements an X509 Trust Manager. The certificates it trusts are
"variable", in the sense that it can dynamically, and temporarily support
different certificates that are not in the keystore.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor initializes the system, user and custom stores -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkTrustClient
(X509Certificate[] chain, String authType, String hostName) Check if client is trusted (no support for custom here, only system/user)void
checkTrustServer
(X509Certificate[] chain, String authType, String hostName, SSLSocket socket, SSLEngine engine) Check if the server is trusted.protected X509Certificate[]
static VariableX509TrustManager
Return an instance of this singleton
-
Constructor Details
-
VariableX509TrustManager
public VariableX509TrustManager()Constructor initializes the system, user and custom stores
-
-
Method Details
-
checkTrustClient
public void checkTrustClient(X509Certificate[] chain, String authType, String hostName) throws CertificateException Check if client is trusted (no support for custom here, only system/user)- Parameters:
chain
- certificate chainauthType
- type of authentificationhostName
- hostnem- Throws:
CertificateException
- if certificate is wrong
-
checkTrustServer
public void checkTrustServer(X509Certificate[] chain, String authType, String hostName, SSLSocket socket, SSLEngine engine) throws CertificateException Check if the server is trusted. First, existing stores are checked to see if the certificate is trusted. Next, if the certificate is not explicitly trusted by the user, a host name check is performed. The user is them prompted as needed.- Parameters:
chain
- The cert chainauthType
- The auth type algorithmhostName
- The expected hostName that the server should havesocket
- The SSLSocket in use (may be null)engine
- The SSLEngine in use (may be null)- Throws:
CertificateException
- if certificate is wrong
-
getAcceptedIssuers
-
getInstance
Return an instance of this singleton- Returns:
- The instance
-