Class DefaultServerKexExtensionHandler
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.kex.extension.DefaultServerKexExtensionHandler
- All Implemented Interfaces:
KexExtensionHandler
public class DefaultServerKexExtensionHandler
extends AbstractLoggingBean
implements KexExtensionHandler
A basic default implementation of a server-side
KexExtensionHandler
handling the
ServerSignatureAlgorithms
KEX extension.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandler
KexExtensionHandler.AvailabilityPhase, KexExtensionHandler.KexPhase
-
Field Summary
Modifier and TypeFieldDescriptionstatic final AttributeRepository.AttributeKey<Boolean>
SessionAttributeRepository.AttributeKey
storing whether the client requested to get the EXT_INFO message.static final AttributeRepository.AttributeKey<Boolean>
SessionAttributeRepository.AttributeKey
storing whether the server sent an EXT_INFO message atKexExtensionHandler.KexPhase.NEWKEYS
.static final DefaultServerKexExtensionHandler
Default singleton instance.Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
collectExtensions
(Session session, KexExtensionHandler.KexPhase phase, BiConsumer<String, Object> marshaller) Collects extension info records, handing them off to the givenmarshaller
for writing into anKexExtensions.SSH_MSG_EXT_INFO
message.void
handleKexInitProposal
(Session session, boolean initiator, Map<KexProposalOption, String> proposal) Invoked when a peer is ready to send the KEX options proposal or has received such a proposal.void
sendKexExtensions
(Session session, KexExtensionHandler.KexPhase phase) Invoked in order to allow the handler to send anSSH_MSG_EXT_INFO
message.Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandler
handleKexCompressionMessage, handleKexExtensionNegotiation, handleKexExtensionRequest, handleKexExtensionsMessage, isKexExtensionsAvailable
-
Field Details
-
INSTANCE
Default singleton instance. -
CLIENT_REQUESTED_EXT_INFO
SessionAttributeRepository.AttributeKey
storing whether the client requested to get the EXT_INFO message. Possible values are:null
- Unknown. We have not yet received the client's KEX proposal. Do not send the message.
Boolean.TRUE
- We have received the client's KEX proposal, and the client has requested to get the EXT_INFO message.
Boolean.FALSE
- We have received the client's KEX proposal, and the client did not request to get the EXT_INFO message. Do not send the message.
-
EXT_INFO_SENT_AT_NEWKEYS
SessionAttributeRepository.AttributeKey
storing whether the server sent an EXT_INFO message atKexExtensionHandler.KexPhase.NEWKEYS
. A server is supposed to send the message at that point only on the very first NEWKEYS message. Possible values are:null
orBoolean.FALSE
- The EXT_INFO message at
KexExtensionHandler.KexPhase.NEWKEYS
was not done yet. Boolean.TRUE
- The EXT_INFO message at
KexExtensionHandler.KexPhase.NEWKEYS
was done.
-
-
Constructor Details
-
DefaultServerKexExtensionHandler
public DefaultServerKexExtensionHandler()
-
-
Method Details
-
handleKexInitProposal
public void handleKexInitProposal(Session session, boolean initiator, Map<KexProposalOption, String> proposal) throws ExceptionDescription copied from interface:KexExtensionHandler
Invoked when a peer is ready to send the KEX options proposal or has received such a proposal. Note: this method is called during the negotiation phase even ifisKexExtensionsAvailable
returnsfalse
for the session.- Specified by:
handleKexInitProposal
in interfaceKexExtensionHandler
- Parameters:
session
- TheSession
initiating or receiving the proposalinitiator
-true
if the proposal is about to be sent,false
if this is a proposal received from the peer.proposal
- The proposal contents - Caveat emptor: the proposal is modifiable i.e., the handler can modify it before being sent or before being processed (if incoming)- Throws:
Exception
- If failed to handle the request
-
sendKexExtensions
Description copied from interface:KexExtensionHandler
Invoked in order to allow the handler to send anSSH_MSG_EXT_INFO
message. Note: this method is called only ifisKexExtensionsAvailable
returnstrue
for the session.- Specified by:
sendKexExtensions
in interfaceKexExtensionHandler
- Parameters:
session
- TheSession
phase
- The phase at which the handler is invoked- Throws:
Exception
- If failed to handle the invocation- See Also:
-
collectExtensions
public void collectExtensions(Session session, KexExtensionHandler.KexPhase phase, BiConsumer<String, Object> marshaller) Collects extension info records, handing them off to the givenmarshaller
for writing into anKexExtensions.SSH_MSG_EXT_INFO
message.This default implementation marshals a
ServerSignatureAlgorithms
extension if thephase
isKexExtensionHandler.KexPhase.NEWKEYS
.- Parameters:
session
-Session
to send the KEX extension information forphase
-KexExtensionHandler.KexPhase
of the SSH protocolmarshaller
-BiConsumer
writing the extensions into an SSH message
-