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 org.apache.sshd.common.util.logging.AbstractLoggingBean implements KexExtensionHandler
A basic default implementation of a server-side KexExtensionHandler handling the ServerSignatureAlgorithms KEX extension.
See Also:
  • Field Details

    • INSTANCE

      public static final DefaultServerKexExtensionHandler INSTANCE
      Default singleton instance.
    • CLIENT_REQUESTED_EXT_INFO

      public static final org.apache.sshd.common.AttributeRepository.AttributeKey<Boolean> CLIENT_REQUESTED_EXT_INFO
      Session AttributeRepository.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

      public static final org.apache.sshd.common.AttributeRepository.AttributeKey<Boolean> EXT_INFO_SENT_AT_NEWKEYS
      Session AttributeRepository.AttributeKey storing whether the server sent an EXT_INFO message at KexExtensionHandler.KexPhase.NEWKEYS. A server is supposed to send the message at that point only on the very first NEWKEYS message. Possible values are:
      null or Boolean.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<org.apache.sshd.common.kex.KexProposalOption, String> proposal) throws Exception
      Description 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 if isKexExtensionsAvailable returns false for the session.
      Specified by:
      handleKexInitProposal in interface KexExtensionHandler
      Parameters:
      session - The Session initiating or receiving the proposal
      initiator - 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

      public void sendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) throws Exception
      Description copied from interface: KexExtensionHandler
      Invoked in order to allow the handler to send an SSH_MSG_EXT_INFO message. Note: this method is called only if isKexExtensionsAvailable returns true for the session.
      Specified by:
      sendKexExtensions in interface KexExtensionHandler
      Parameters:
      session - The Session
      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 given marshaller for writing into an KexExtensions.SSH_MSG_EXT_INFO message.

      This default implementation marshals a ServerSignatureAlgorithms extension if the phase is KexExtensionHandler.KexPhase.NEWKEYS.

      Parameters:
      session - Session to send the KEX extension information for
      phase - KexExtensionHandler.KexPhase of the SSH protocol
      marshaller - BiConsumer writing the extensions into an SSH message