Top Description Fields Constructors Methods
org.apache.sshd.common.kex.extension

public Class DefaultServerKexExtensionHandler

extends AbstractLoggingBean
implements KexExtensionHandler
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.kex.extension.KexExtensionHandler
Imports
java.util.Arrays, .Collection, .LinkedHashMap, .Map, java.util.function.BiConsumer, org.apache.sshd.common.AttributeRepository.AttributeKey, org.apache.sshd.common.kex.KexProposalOption, org.apache.sshd.common.kex.extension.parser.ServerSignatureAlgorithms, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.logging.AbstractLoggingBean

A basic default implementation of a server-side KexExtensionHandler handling the ServerSignatureAlgorithms KEX extension.
See Also
RFC 8308

Field Summary

Modifier and TypeField and Description
public static final AttributeRepository.AttributeKey<Boolean>
CLIENT_REQUESTED_EXT_INFO

Session AttributeKey storing whether the client requested to get the EXT_INFO message.

public static final AttributeRepository.AttributeKey<Boolean>
EXT_INFO_SENT_AT_NEWKEYS

Session AttributeKey storing whether the server sent an EXT_INFO message at KexPhase#NEWKEYS.

public static final DefaultServerKexExtensionHandler
INSTANCE

Default singleton instance.

Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
collectExtensions(Session
Session to send the KEX extension information for
session
,
KexExtensionHandler.KexPhase
KexPhase of the SSH protocol
phase
,
BiConsumer<String, Object>
BiConsumer writing the extensions into an SSH message
marshaller
)

Collects extension info records, handing them off to the given marshaller for writing into an KexExtensions#SSH_MSG_EXT_INFO message.

public void
handleKexInitProposal(Session
The Session initiating or receiving the proposal
session
,
boolean
true if the proposal is about to be sent, false if this is a proposal received from the peer.
initiator
,
Map<KexProposalOption, String>
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)
proposal
)

Overrides default org.apache.sshd.common.kex.extension.KexExtensionHandler.handleKexInitProposal.

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.

public void
sendKexExtensions(Session session, KexExtensionHandler.KexPhase
The phase at which the handler is invoked
phase
)

Overrides default org.apache.sshd.common.kex.extension.KexExtensionHandler.sendKexExtensions.

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.

Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
debugdebugdebugdebugdebugerrorerrorerrorerrorerrorgetSimplifiedLoggerinfoinfowarnwarnwarnwarnwarnwarnwarnwarn

Field Detail

CLIENT_REQUESTED_EXT_INFOback to summary
public static final AttributeRepository.AttributeKey<Boolean> CLIENT_REQUESTED_EXT_INFO

Session 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_NEWKEYSback to summary
public static final AttributeRepository.AttributeKey<Boolean> EXT_INFO_SENT_AT_NEWKEYS

Session AttributeKey storing whether the server sent an EXT_INFO message at 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 KexPhase#NEWKEYS was not done yet.
Boolean.TRUE
The EXT_INFO message at KexPhase#NEWKEYS was done.
Annotations
@SuppressWarnings:javadoc
INSTANCEback to summary
public static final DefaultServerKexExtensionHandler INSTANCE

Default singleton instance.

Constructor Detail

DefaultServerKexExtensionHandlerback to summary
public DefaultServerKexExtensionHandler()

Method Detail

collectExtensionsback to summary
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 KexPhase#NEWKEYS.

Parameters
session:Session

Session to send the KEX extension information for

phase:KexExtensionHandler.KexPhase

KexPhase of the SSH protocol

marshaller:BiConsumer<String, Object>

BiConsumer writing the extensions into an SSH message

Annotations
@SuppressWarnings:javadoc
handleKexInitProposalback to summary
public void handleKexInitProposal(Session session, boolean initiator, Map<KexProposalOption, String> proposal) throws Exception

Overrides default org.apache.sshd.common.kex.extension.KexExtensionHandler.handleKexInitProposal.

Doc from org.apache.sshd.common.kex.extension.KexExtensionHandler.handleKexInitProposal.

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.

Parameters
session:Session

The Session initiating or receiving the proposal

initiator:boolean

true if the proposal is about to be sent, false if this is a proposal received from the peer.

proposal:Map<KexProposalOption, String>

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)

Annotations
@Override
Exceptions
Exception:
If failed to handle the request
sendKexExtensionsback to summary
public void sendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) throws Exception

Overrides default org.apache.sshd.common.kex.extension.KexExtensionHandler.sendKexExtensions.

Doc from org.apache.sshd.common.kex.extension.KexExtensionHandler.sendKexExtensions.

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.

Parameters
session:Session

The Session

phase:KexExtensionHandler.KexPhase

The phase at which the handler is invoked

Annotations
@Override
Exceptions
Exception:
If failed to handle the invocation