Package net.schmizz.sshj.userauth.method
Class AuthPublickey
java.lang.Object
net.schmizz.sshj.userauth.method.AbstractAuthMethod
net.schmizz.sshj.userauth.method.KeyedAuthMethod
net.schmizz.sshj.userauth.method.AuthPublickey
- All Implemented Interfaces:
SSHPacketHandler
,AuthMethod
Implements the
"publickey"
SSH authentication method.
Requesting authentication with this method first sends a "feeler" request with just the public key, and if the
server responds with SSH_MSG_USERAUTH_PK_OK
indicating that the key is acceptable, it proceeds to send a
request signed with the private key. Therefore, private keys are not requested from the associated KeyProvider
unless needed.-
Field Summary
Fields inherited from class net.schmizz.sshj.userauth.method.KeyedAuthMethod
kProv
Fields inherited from class net.schmizz.sshj.userauth.method.AbstractAuthMethod
log, params
-
Constructor Summary
ConstructorsConstructorDescriptionAuthPublickey
(KeyProvider kProv) Initialize this method with the provider for public and private key. -
Method Summary
Methods inherited from class net.schmizz.sshj.userauth.method.KeyedAuthMethod
putPubKey, putSig, shouldRetry
Methods inherited from class net.schmizz.sshj.userauth.method.AbstractAuthMethod
getName, init, makeAccountResource, request, setLoggerFactory
-
Constructor Details
-
AuthPublickey
Initialize this method with the provider for public and private key.
-
-
Method Details
-
handle
Internal use.- Specified by:
handle
in interfaceSSHPacketHandler
- Overrides:
handle
in classAbstractAuthMethod
- Parameters:
cmd
- the SSHmessage identifier
buf
-SSHPacket
containing rest of the request- Throws:
UserAuthException
TransportException
-
buildReq
Builds SSH_MSG_USERAUTH_REQUEST packet.- Parameters:
signed
- whether the request packet will contain signature- Returns:
- the
SSHPacket
containing the request packet - Throws:
UserAuthException
-
sendSignedReq
Send SSH_MSG_USERAUTH_REQUEST containing the signature.- Throws:
UserAuthException
TransportException
-
buildReq
Builds a feeler request (sans signature).- Overrides:
buildReq
in classAbstractAuthMethod
- Throws:
UserAuthException
-