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
kProvFields 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, shouldRetryMethods 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:
handlein interfaceSSHPacketHandler- Overrides:
handlein classAbstractAuthMethod- Parameters:
cmd- the SSHmessage identifierbuf-SSHPacketcontaining rest of the request- Throws:
UserAuthExceptionTransportException
-
buildReq
Builds SSH_MSG_USERAUTH_REQUEST packet.- Parameters:
signed- whether the request packet will contain signature- Returns:
- the
SSHPacketcontaining the request packet - Throws:
UserAuthException
-
sendSignedReq
Send SSH_MSG_USERAUTH_REQUEST containing the signature.- Throws:
UserAuthExceptionTransportException
-
buildReq
Builds a feeler request (sans signature).- Overrides:
buildReqin classAbstractAuthMethod- Throws:
UserAuthException
-