Interface KexExtensionHandler
-
- All Known Implementing Classes:
DefaultClientKexExtensionHandler
,DefaultServerKexExtensionHandler
public interface KexExtensionHandler
Used to support RFC 8308- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
KexExtensionHandler.AvailabilityPhase
Provides a hint as to the context in whichisKexExtensionsAvailable
is invokedstatic class
KexExtensionHandler.KexPhase
The phase at whichsendKexExtensions
is invoked
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default 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 Detail
-
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 Exception
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 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,String> s2cOptions, String sValue) throws Exception
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.- Parameters:
session
- TheSession
phase
- The phase at which the handler is invoked- Throws:
Exception
- If failed to handle the invocation- See Also:
- RFC-8308 - section 2.4
-
handleKexExtensionsMessage
default boolean handleKexExtensionsMessage(Session session, Buffer buffer) throws Exception
Parses theSSH_MSG_EXT_INFO
message. Note: this method is called regardless of whetherisKexExtensionsAvailable
returnstrue
for the session.- Parameters:
session
- TheSession
through which the message was receivedbuffer
- The message buffer- Returns:
true
if message handled - iffalse
thenSSH_MSG_UNIMPLEMENTED
will be generated- Throws:
Exception
- If failed to handle the message- See Also:
- RFC-8308 - section 2.3,
handleKexExtensionRequest(Session, int, int, String, byte[])
-
handleKexCompressionMessage
default boolean handleKexCompressionMessage(Session session, Buffer buffer) throws Exception
Parses theSSH_MSG_NEWCOMPRESS
message. Note: this method is called regardless of whetherisKexExtensionsAvailable
returnstrue
for the session.- Parameters:
session
- TheSession
through which the message was receivedbuffer
- The message buffer- Returns:
true
if message handled - iffalse
thenSSH_MSG_UNIMPLEMENTED
will be generated- Throws:
Exception
- If failed to handle the message- See Also:
- RFC-8308 - section 3.2
-
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
-
-