Top Description Inners Methods
org.apache.sshd.common.kex.extension

public Interface KexExtensionHandler

Known Direct Implementers
org.apache.sshd.common.kex.extension.DefaultClientKexExtensionHandler, org.apache.sshd.common.kex.extension.DefaultServerKexExtensionHandler
Imports
java.io.IOException, java.util.Collections, .EnumSet, .Map, .Set, org.apache.sshd.common.kex.KexProposalOption, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.buffer.Buffer

Used to support RFC 8308
Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
KexExtensionHandler.AvailabilityPhase

Provides a hint as to the context in which isKexExtensionsAvailable is invoked

public static enum
KexExtensionHandler.KexPhase

The phase at which sendKexExtensions is invoked

Method Summary

Modifier and TypeMethod and Description
public default boolean

Returns:

true if message handled - if false then SSH_MSG_UNIMPLEMENTED will be generated
handleKexCompressionMessage
(Session
The Session through which the message was received
session
,
Buffer
The message buffer
buffer
)

Parses the SSH_MSG_NEWCOMPRESS message

Note

this method is called regardless of whether isKexExtensionsAvailable returns true for the session.

public default void
handleKexExtensionNegotiation(Session
The Session executing the negotiation
session
,
KexProposalOption
The negotiated KexProposalOption
option
,
String
The negotiated option value (may be null/empty).
nValue
,
Map<KexProposalOption, String>
The client proposals
c2sOptions
,
String
The client-side value for the option (may be null/empty).
cValue
,
Map<KexProposalOption, String>
The server proposals
s2cOptions
,
String
The server-side value for the option (may be null/empty).
sValue
)

Invoked during the KEX negotiation phase to inform about option being negotiated

Note

this method is called during the negotiation phase even if isKexExtensionsAvailable returns false for the session.

public default boolean

Returns:

true whether to proceed to the next extension or stop processing the rest
handleKexExtensionRequest
(Session
The Session through which the message was received
session
,
int
The 0-based extension index
index
,
int
The total extensions in the message
count
,
String
The extension name
name
,
byte[]
The extension data
data
)

Invoked by handleKexExtensionsMessage(Session, Buffer) in order to handle a specific extension.

public default boolean

Returns:

true if message handled - if false then SSH_MSG_UNIMPLEMENTED will be generated
handleKexExtensionsMessage
(Session
The Session through which the message was received
session
,
Buffer
The message buffer
buffer
)

Parses the SSH_MSG_EXT_INFO message

Note

this method is called regardless of whether isKexExtensionsAvailable returns true for the session.

public default 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
)

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 default boolean

Returns:

true whether to KEX extensions are supported/allowed for the session
isKexExtensionsAvailable
(Session
The Session about to execute KEX
session
,
KexExtensionHandler.AvailabilityPhase
The AvailabilityPhase hint as to why the query is being made
phase
)

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

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.

Method Detail

handleKexCompressionMessageback to summary
public default boolean handleKexCompressionMessage(Session session, Buffer buffer) throws Exception

Parses the SSH_MSG_NEWCOMPRESS message

Note

this method is called regardless of whether isKexExtensionsAvailable returns true for the session.

Parameters
session:Session

The Session through which the message was received

buffer:Buffer

The message buffer

Returns:boolean

true if message handled - if false then SSH_MSG_UNIMPLEMENTED will be generated

Exceptions
Exception:
If failed to handle the message
See Also
RFC-8308 - section 3.2
handleKexExtensionNegotiationback to summary
public 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 if isKexExtensionsAvailable returns false for the session.

Parameters
session:Session

The Session executing the negotiation

option:KexProposalOption

The negotiated KexProposalOption

nValue:String

The negotiated option value (may be null/empty).

c2sOptions:Map<KexProposalOption, String>

The client proposals

cValue:String

The client-side value for the option (may be null/empty).

s2cOptions:Map<KexProposalOption, String>

The server proposals

sValue:String

The server-side value for the option (may be null/empty).

Exceptions
Exception:
If failed to handle the invocation
handleKexExtensionRequestback to summary
public default boolean handleKexExtensionRequest(Session session, int index, int count, String name, byte[] data) throws Exception

Invoked by handleKexExtensionsMessage(Session, Buffer) in order to handle a specific extension.

Parameters
session:Session

The Session through which the message was received

index:int

The 0-based extension index

count:int

The total extensions in the message

name:String

The extension name

data:byte[]

The extension data

Returns:boolean

true whether to proceed to the next extension or stop processing the rest

Exceptions
Exception:
If failed to handle the extension
handleKexExtensionsMessageback to summary
public default boolean handleKexExtensionsMessage(Session session, Buffer buffer) throws Exception

Parses the SSH_MSG_EXT_INFO message

Note

this method is called regardless of whether isKexExtensionsAvailable returns true for the session.

Parameters
session:Session

The Session through which the message was received

buffer:Buffer

The message buffer

Returns:boolean

true if message handled - if false then SSH_MSG_UNIMPLEMENTED will be generated

Exceptions
Exception:
If failed to handle the message
See Also
RFC-8308 - section 2.3, handleKexExtensionRequest(Session, int, int, String, byte[])
handleKexInitProposalback to summary
public 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 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)

Exceptions
Exception:
If failed to handle the request
isKexExtensionsAvailableback to summary
public default boolean isKexExtensionsAvailable(Session session, KexExtensionHandler.AvailabilityPhase phase) throws IOException
Parameters
session:Session

The Session about to execute KEX

phase:KexExtensionHandler.AvailabilityPhase

The AvailabilityPhase hint as to why the query is being made

Returns:boolean

true whether to KEX extensions are supported/allowed for the session

Exceptions
IOException:
If failed to process the request
sendKexExtensionsback to summary
public default void sendKexExtensions(Session session, KexExtensionHandler.KexPhase phase) throws Exception

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

Exceptions
Exception:
If failed to handle the invocation
See Also
RFC-8308 - section 2.4
org.apache.sshd.common.kex.extension back to summary

public final Enum KexExtensionHandler.AvailabilityPhase

extends Enum<KexExtensionHandler.AvailabilityPhase>
Class Inheritance

Provides a hint as to the context in which isKexExtensionsAvailable is invoked
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final KexExtensionHandler.AvailabilityPhase
AUTHOK

About to send SSH_MSG_USERAUTH_SUCCESS message

Note

currently invoked only by server sessions, but code should not rely on this implicit assumption.

public static final KexExtensionHandler.AvailabilityPhase
NEWKEYS

About to send the SSH_MSG_NEWKEYS message

public static final KexExtensionHandler.AvailabilityPhase
PREKEX

Decide whether to delay sending the KEX-INIT message until the peer one has been received

Note

currently invoked only by client sessions, but code should not rely on this implicit assumption.

public static final KexExtensionHandler.AvailabilityPhase
PROPOSAL

About to create the KEX-INIT proposal - should this session declare it support the KEX negotiation extension mechanism or not.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static KexExtensionHandler.AvailabilityPhase
public static KexExtensionHandler.AvailabilityPhase[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AUTHOKback to summary
public static final KexExtensionHandler.AvailabilityPhase AUTHOK

About to send SSH_MSG_USERAUTH_SUCCESS message

Note

currently invoked only by server sessions, but code should not rely on this implicit assumption.

NEWKEYSback to summary
public static final KexExtensionHandler.AvailabilityPhase NEWKEYS

About to send the SSH_MSG_NEWKEYS message

PREKEXback to summary
public static final KexExtensionHandler.AvailabilityPhase PREKEX

Decide whether to delay sending the KEX-INIT message until the peer one has been received

Note

currently invoked only by client sessions, but code should not rely on this implicit assumption.

PROPOSALback to summary
public static final KexExtensionHandler.AvailabilityPhase PROPOSAL

About to create the KEX-INIT proposal - should this session declare it support the KEX negotiation extension mechanism or not.

Constructor Detail

AvailabilityPhaseback to summary
private AvailabilityPhase()

Method Detail

valueOfback to summary
public static KexExtensionHandler.AvailabilityPhase valueOf(String name)
valuesback to summary
public static KexExtensionHandler.AvailabilityPhase[] values()
org.apache.sshd.common.kex.extension back to summary

public final Enum KexExtensionHandler.KexPhase

extends Enum<KexExtensionHandler.KexPhase>
Class Inheritance

The phase at which sendKexExtensions is invoked
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final KexExtensionHandler.KexPhase
public static final KexExtensionHandler.KexPhase
public static final Set<KexExtensionHandler.KexPhase>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static KexExtensionHandler.KexPhase
public static KexExtensionHandler.KexPhase[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AUTHOKback to summary
public static final KexExtensionHandler.KexPhase AUTHOK
NEWKEYSback to summary
public static final KexExtensionHandler.KexPhase NEWKEYS
VALUESback to summary
public static final Set<KexExtensionHandler.KexPhase> VALUES

Constructor Detail

KexPhaseback to summary
private KexPhase()

Method Detail

valueOfback to summary
public static KexExtensionHandler.KexPhase valueOf(String name)
valuesback to summary
public static KexExtensionHandler.KexPhase[] values()