@IgnoreJRERequirement public class PublicKeyMatchingX509ExtendedTrustManager extends X509ExtendedTrustManager
X509ExtendedTrustManager that trusts any chain where the initial certificate was issued for a specific
set of trusted PublicKeys.| Constructor and Description |
|---|
PublicKeyMatchingX509ExtendedTrustManager(boolean strictClient,
boolean strictServer,
PublicKey... publicKeys)
Creates a
TrustManager that will only trust certificate chains where the first certificate's
Certificate.getPublicKey() is in the list of trusted public keys. |
PublicKeyMatchingX509ExtendedTrustManager(PublicKey... publicKeys)
Creates a
TrustManager that will only trust certificate chains where the first certificate's
Certificate.getPublicKey() is in the list of trusted public keys. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(PublicKey publicKey)
Adds a trusted
PublicKey. |
void |
checkClientTrusted(X509Certificate[] chain,
String authType) |
void |
checkClientTrusted(X509Certificate[] chain,
String authType,
Socket socket) |
void |
checkClientTrusted(X509Certificate[] chain,
String authType,
SSLEngine engine) |
void |
checkServerTrusted(X509Certificate[] chain,
String authType) |
void |
checkServerTrusted(X509Certificate[] chain,
String authType,
Socket socket) |
void |
checkServerTrusted(X509Certificate[] chain,
String authType,
SSLEngine engine) |
void |
clear()
Clears the trusted public keys.
|
X509Certificate[] |
getAcceptedIssuers() |
boolean |
isTrusted(PublicKey publicKey)
Check if a
PublicKey is trusted. |
boolean |
remove(PublicKey publicKey)
Removes a trusted
PublicKey. |
public PublicKeyMatchingX509ExtendedTrustManager(PublicKey... publicKeys)
TrustManager that will only trust certificate chains where the first certificate's
Certificate.getPublicKey() is in the list of trusted public keys.publicKeys - the initial list of trusted public keys.public PublicKeyMatchingX509ExtendedTrustManager(boolean strictClient,
boolean strictServer,
PublicKey... publicKeys)
TrustManager that will only trust certificate chains where the first certificate's
Certificate.getPublicKey() is in the list of trusted public keys. The strictClient
and strictServer options are useful when establishing trust between two unknown systems and
encryption is required before the initial trust can be established and the list of trusted keys populated.strictClient - set this to false if you want to accept connections from clients before you have
trusted any public keys.strictServer - set this to false if you want to connect to servers before you
have trusted any public keys.publicKeys - the initial list of trusted public keys.public boolean add(@Nonnull PublicKey publicKey)
PublicKey.publicKey - the key to trust.true if this instance did not already trust the specified public keypublic boolean remove(PublicKey publicKey)
PublicKey.publicKey - the key to trust.true if this instance trusted the specified public keypublic boolean isTrusted(PublicKey publicKey)
PublicKey is trusted.publicKey - the key to check.true if this instance trusts the specified public key.public void clear()
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException
checkClientTrusted in class X509ExtendedTrustManagerCertificateExceptionpublic void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException
checkServerTrusted in class X509ExtendedTrustManagerCertificateExceptionpublic void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException
checkClientTrusted in class X509ExtendedTrustManagerCertificateExceptionpublic void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException
checkServerTrusted in class X509ExtendedTrustManagerCertificateExceptionpublic void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
CertificateExceptionpublic void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
CertificateExceptionpublic X509Certificate[] getAcceptedIssuers()
Copyright © 2004–2017. All rights reserved.