Package com.sshtools.client
Class PublicKeyAuthenticator
java.lang.Object
com.sshtools.common.ssh.AbstractRequestFuture
com.sshtools.client.SimpleClientAuthenticator
com.sshtools.client.PublicKeyAuthenticator
- All Implemented Interfaces:
ClientAuthenticator
,com.sshtools.common.ssh.RequestFuture
- Direct Known Subclasses:
ExternalKeyAuthenticator
,IdentityFileAuthenticator
,KeyPairAuthenticator
,PrivateKeyFileAuthenticator
public abstract class PublicKeyAuthenticator
extends SimpleClientAuthenticator
implements ClientAuthenticator
Implements public key authentication taking a separately loaded SshKeyPair as the private key for authentication.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
authenticate
(TransportProtocolClient transport, String username) Start the authenticationprotected abstract com.sshtools.common.ssh.components.SshKeyPair
getName()
The authentication mechanism name/.protected abstract com.sshtools.common.ssh.components.SshPublicKey
protected com.sshtools.common.publickey.SignatureGenerator
protected abstract boolean
protected void
onStartAuthentication
(com.sshtools.synergy.ssh.Connection<SshClientContext> con) boolean
processMessage
(com.sshtools.common.util.ByteArrayReader msg) Process an authentication message.byte[]
Methods inherited from class com.sshtools.client.SimpleClientAuthenticator
cancel, failure, getAuthenticationMethods, isCancelled, isMoreAuthenticationRequired, success, success
Methods inherited from class com.sshtools.common.ssh.AbstractRequestFuture
addFutureListener, done, isDone, isSuccess, waitFor, waitForever
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sshtools.client.ClientAuthenticator
cancel, failure, getAuthenticationMethods, isCancelled, isMoreAuthenticationRequired, success, success
Methods inherited from interface com.sshtools.common.ssh.RequestFuture
addFutureListener, isDone, isDoneAndSuccess, isSuccess, waitFor, waitForever
-
Field Details
-
SSH_MSG_USERAUTH_PK_OK
public static final int SSH_MSG_USERAUTH_PK_OK- See Also:
-
-
Constructor Details
-
PublicKeyAuthenticator
public PublicKeyAuthenticator()
-
-
Method Details
-
authenticate
public void authenticate(TransportProtocolClient transport, String username) throws IOException, com.sshtools.common.ssh.SshException Description copied from interface:ClientAuthenticator
Start the authentication- Specified by:
authenticate
in interfaceClientAuthenticator
- Throws:
IOException
com.sshtools.common.ssh.SshException
-
onStartAuthentication
-
getNextKey
- Throws:
IOException
-
getAuthenticatingKey
protected abstract com.sshtools.common.ssh.components.SshKeyPair getAuthenticatingKey() throws IOException, com.sshtools.common.publickey.InvalidPassphraseException- Throws:
IOException
com.sshtools.common.publickey.InvalidPassphraseException
-
hasCredentialsRemaining
protected abstract boolean hasCredentialsRemaining() -
getSignatureGenerator
protected com.sshtools.common.publickey.SignatureGenerator getSignatureGenerator() throws IOException, com.sshtools.common.publickey.InvalidPassphraseException- Throws:
IOException
com.sshtools.common.publickey.InvalidPassphraseException
-
processMessage
public boolean processMessage(com.sshtools.common.util.ByteArrayReader msg) throws IOException, com.sshtools.common.ssh.SshException Description copied from interface:ClientAuthenticator
Process an authentication message.- Specified by:
processMessage
in interfaceClientAuthenticator
- Overrides:
processMessage
in classSimpleClientAuthenticator
- Returns:
- Throws:
IOException
com.sshtools.common.ssh.SshException
-
sign
public byte[] sign(com.sshtools.common.ssh.components.SshPrivateKey prv, String signingAlgorithm, byte[] data) throws com.sshtools.common.ssh.SshException - Throws:
com.sshtools.common.ssh.SshException
-
getName
Description copied from interface:ClientAuthenticator
The authentication mechanism name/.- Specified by:
getName
in interfaceClientAuthenticator
- Returns:
-