Interface KexExtensionHandler
- All Known Implementing Classes:
DefaultClientKexExtensionHandler
,DefaultServerKexExtensionHandler
public interface KexExtensionHandler
Used to support RFC 8308
- Author:
- Apache MINA SSHD Project
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Provides a hint as to the context in whichisKexExtensionsAvailable
is invokedstatic enum
The phase at whichsendKexExtensions
is invoked -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
handleKexCompressionMessage
(Session session, Buffer buffer) Parses theSSH_MSG_NEWCOMPRESS
message.default void
handleKexExtensionNegotiation
(Session session, KexProposalOption option, String nValue, Map<KexProposalOption, String> c2sOptions, String cValue, Map<KexProposalOption, String> s2cOptions, String sValue) Invoked during the KEX negotiation phase to inform about option being negotiated.default boolean
handleKexExtensionRequest
(Session session, int index, int count, String name, byte[] data) Invoked byhandleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.default boolean
handleKexExtensionsMessage
(Session session, Buffer buffer) Parses theSSH_MSG_EXT_INFO
message.default 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.default boolean
isKexExtensionsAvailable
(Session session, KexExtensionHandler.AvailabilityPhase phase) default void
sendKexExtensions
(Session session, KexExtensionHandler.KexPhase phase) Invoked in order to allow the handler to send anSSH_MSG_EXT_INFO
message.
-
Method Details
-
isKexExtensionsAvailable
default boolean isKexExtensionsAvailable(Session session, KexExtensionHandler.AvailabilityPhase phase) throws IOException - Parameters:
session
- TheSession
about to execute KEXphase
- TheKexExtensionHandler.AvailabilityPhase
hint as to why the query is being made- Returns:
true
whether to KEX extensions are supported/allowed for the session- Throws:
IOException
- If failed to process the request
-
handleKexInitProposal
default void handleKexInitProposal(Session session, boolean initiator, Map<KexProposalOption, String> proposal) throws ExceptionInvoked 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.- 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
-
handleKexExtensionNegotiation
default void handleKexExtensionNegotiation(Session session, KexProposalOption option, String nValue, Map<KexProposalOption, String> c2sOptions, String cValue, Map<KexProposalOption, throws ExceptionString> s2cOptions, String sValue) Invoked during the KEX negotiation phase to inform about option being negotiated. Note: this method is called during the negotiation phase even ifisKexExtensionsAvailable
returnsfalse
for the session.- Parameters:
session
- TheSession
executing the negotiationoption
- The negotiatedKexProposalOption
nValue
- The negotiated option value (may benull
/empty).c2sOptions
- The client proposalscValue
- The client-side value for the option (may benull
/empty).s2cOptions
- The server proposalssValue
- The server-side value for the option (may benull
/empty).- Throws:
Exception
- If failed to handle the invocation
-
sendKexExtensions
default void sendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) throws Exception 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. -
handleKexExtensionsMessage
Parses theSSH_MSG_EXT_INFO
message. Note: this method is called regardless of whetherisKexExtensionsAvailable
returnstrue
for the session. -
handleKexCompressionMessage
Parses theSSH_MSG_NEWCOMPRESS
message. Note: this method is called regardless of whetherisKexExtensionsAvailable
returnstrue
for the session. -
handleKexExtensionRequest
default boolean handleKexExtensionRequest(Session session, int index, int count, String name, byte[] data) throws Exception Invoked byhandleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.- Parameters:
session
- TheSession
through which the message was receivedindex
- The 0-based extension indexcount
- The total extensions in the messagename
- The extension namedata
- The extension data- Returns:
true
whether to proceed to the next extension or stop processing the rest- Throws:
Exception
- If failed to handle the extension
-