Package com.sshtools.common.knownhosts
Class X509HostKeyVerification
java.lang.Object
com.sshtools.common.knownhosts.X509HostKeyVerification
- All Implemented Interfaces:
HostKeyVerification
This is a
HostKeyVerification implementation that will validate an X509 public key.- Author:
- lee
-
Constructor Summary
ConstructorsConstructorDescriptionX509HostKeyVerification(boolean enableRevocation) This creates a verification instance that will check the validation of a certificate against the Java runtime's trusted CA certs keystore.X509HostKeyVerification(Set<TrustAnchor> trustAnchors, boolean enableRevocation) This creates a verification instance against a specific set of TrustAnchors -
Method Summary
Modifier and TypeMethodDescriptionbooleanverifyHost(String host, SshPublicKey pk) Verify that the public key is acceptable for the host.
-
Constructor Details
-
X509HostKeyVerification
public X509HostKeyVerification(boolean enableRevocation) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException, InvalidAlgorithmParameterException This creates a verification instance that will check the validation of a certificate against the Java runtime's trusted CA certs keystore.- Parameters:
enableRevocation-- Throws:
IOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionCertificateExceptionInvalidAlgorithmParameterException
-
X509HostKeyVerification
public X509HostKeyVerification(Set<TrustAnchor> trustAnchors, boolean enableRevocation) throws InvalidAlgorithmParameterException This creates a verification instance against a specific set of TrustAnchors- Parameters:
trustAnchors-enableRevocation-- Throws:
InvalidAlgorithmParameterException
-
-
Method Details
-
verifyHost
Description copied from interface:HostKeyVerificationVerify that the public key is acceptable for the host.- Specified by:
verifyHostin interfaceHostKeyVerification- Parameters:
host- the name of the connected hostpk- the public key supplied by the host- Returns:
trueif the host key is acceptable otherwisefalse- Throws:
SshException
-