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
FieldsModifier and TypeFieldDescriptionstatic final AttributeRepository.AttributeKey<Boolean> SessionAttributeRepository.AttributeKeystoring whether the client requested to get the EXT_INFO message.static final AttributeRepository.AttributeKey<Boolean> SessionAttributeRepository.AttributeKeystoring whether the server sent an EXT_INFO message atKexExtensionHandler.KexPhase.NEWKEYS.static final DefaultServerKexExtensionHandlerDefault singleton instance.Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectExtensions(Session session, KexExtensionHandler.KexPhase phase, BiConsumer<String, Object> marshaller) Collects extension info records, handing them off to the givenmarshallerfor writing into anKexExtensions.SSH_MSG_EXT_INFOmessage.voidhandleKexInitProposal(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.voidsendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) Invoked in order to allow the handler to send anSSH_MSG_EXT_INFOmessage.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, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.AttributeKeystoring 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.AttributeKeystoring 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:nullorBoolean.FALSE- The EXT_INFO message at
KexExtensionHandler.KexPhase.NEWKEYSwas not done yet. Boolean.TRUE- The EXT_INFO message at
KexExtensionHandler.KexPhase.NEWKEYSwas 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:KexExtensionHandlerInvoked 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 ifisKexExtensionsAvailablereturnsfalsefor the session.- Specified by:
handleKexInitProposalin interfaceKexExtensionHandler- Parameters:
session- TheSessioninitiating or receiving the proposalinitiator-trueif the proposal is about to be sent,falseif 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:KexExtensionHandlerInvoked in order to allow the handler to send anSSH_MSG_EXT_INFOmessage. Note: this method is called only ifisKexExtensionsAvailablereturnstruefor the session.- Specified by:
sendKexExtensionsin interfaceKexExtensionHandler- Parameters:
session- TheSessionphase- 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 givenmarshallerfor writing into anKexExtensions.SSH_MSG_EXT_INFOmessage.This default implementation marshals a
ServerSignatureAlgorithmsextension if thephaseisKexExtensionHandler.KexPhase.NEWKEYS.- Parameters:
session-Sessionto send the KEX extension information forphase-KexExtensionHandler.KexPhaseof the SSH protocolmarshaller-BiConsumerwriting the extensions into an SSH message
-