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-sideKexExtensionHandlerhandling theServerSignatureAlgorithmsKEX extension.- See Also:
- RFC 8308
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandler
KexExtensionHandler.AvailabilityPhase, KexExtensionHandler.KexPhase
-
-
Field Summary
Fields Modifier and Type Field Description static AttributeRepository.AttributeKey<Boolean>CLIENT_REQUESTED_EXT_INFOSessionAttributeRepository.AttributeKeystoring whether the client requested to get the EXT_INFO message.static AttributeRepository.AttributeKey<Boolean>EXT_INFO_SENT_AT_NEWKEYSSessionAttributeRepository.AttributeKeystoring whether the server sent an EXT_INFO message atKexExtensionHandler.KexPhase.NEWKEYS.static DefaultServerKexExtensionHandlerINSTANCEDefault singleton instance.-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description DefaultServerKexExtensionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectExtensions(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, 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 Detail
-
INSTANCE
public static final DefaultServerKexExtensionHandler INSTANCE
Default singleton instance.
-
CLIENT_REQUESTED_EXT_INFO
public static final AttributeRepository.AttributeKey<Boolean> 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
public static final AttributeRepository.AttributeKey<Boolean> 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.
-
-
Method Detail
-
handleKexInitProposal
public void handleKexInitProposal(Session session, boolean initiator, Map<KexProposalOption,String> proposal) throws Exception
Description 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
public void sendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) throws Exception
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:
- RFC-8308 - section 2.4
-
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
-
-