Class DefaultClientKexExtensionHandler
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.kex.extension.DefaultClientKexExtensionHandler
-
- All Implemented Interfaces:
KexExtensionHandler
public class DefaultClientKexExtensionHandler extends AbstractLoggingBean implements KexExtensionHandler
Detects if the server sends a "server-sig-algs" and updates the client session by adding the "rsa-sha2-256/512" signature factories (if not already added).- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandler
KexExtensionHandler.AvailabilityPhase, KexExtensionHandler.KexPhase
-
-
Field Summary
Fields Modifier and Type Field Description static AttributeRepository.AttributeKey<Boolean>
CLIENT_PROPOSAL_MADE
SessionAttributeRepository.AttributeKey
used to store whether the extension indicator was already sent.static DefaultClientKexExtensionHandler
INSTANCE
Default singleton instance.static AttributeRepository.AttributeKey<Set<String>>
SERVER_ALGORITHMS
SessionAttributeRepository.AttributeKey
storing the algorithms announced by the server as known.-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description DefaultClientKexExtensionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
handleKexExtensionRequest(Session session, int index, int count, String name, byte[] data)
Invoked byKexExtensionHandler.handleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.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.protected void
handleServerSignatureAlgorithms(Session session, Collection<String> serverAlgorithms)
Perform updates after a server-sig-algs extension has been received.boolean
isKexExtensionsAvailable(Session session, KexExtensionHandler.AvailabilityPhase phase)
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.kex.extension.KexExtensionHandler
handleKexCompressionMessage, handleKexExtensionNegotiation, handleKexExtensionsMessage, sendKexExtensions
-
-
-
-
Field Detail
-
INSTANCE
public static final DefaultClientKexExtensionHandler INSTANCE
Default singleton instance.
-
CLIENT_PROPOSAL_MADE
public static final AttributeRepository.AttributeKey<Boolean> CLIENT_PROPOSAL_MADE
SessionAttributeRepository.AttributeKey
used to store whether the extension indicator was already sent.
-
SERVER_ALGORITHMS
public static final AttributeRepository.AttributeKey<Set<String>> SERVER_ALGORITHMS
SessionAttributeRepository.AttributeKey
storing the algorithms announced by the server as known.
-
-
Method Detail
-
isKexExtensionsAvailable
public boolean isKexExtensionsAvailable(Session session, KexExtensionHandler.AvailabilityPhase phase) throws IOException
- Specified by:
isKexExtensionsAvailable
in interfaceKexExtensionHandler
- 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
public void handleKexInitProposal(Session session, boolean initiator, Map<KexProposalOption,String> proposal) throws IOException
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 ifisKexExtensionsAvailable
returnsfalse
for the session.- Specified by:
handleKexInitProposal
in interfaceKexExtensionHandler
- 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:
IOException
-
handleKexExtensionRequest
public boolean handleKexExtensionRequest(Session session, int index, int count, String name, byte[] data) throws IOException
Description copied from interface:KexExtensionHandler
Invoked byKexExtensionHandler.handleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.- Specified by:
handleKexExtensionRequest
in interfaceKexExtensionHandler
- 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:
IOException
-
handleServerSignatureAlgorithms
protected void handleServerSignatureAlgorithms(Session session, Collection<String> serverAlgorithms)
Perform updates after a server-sig-algs extension has been received. The set of algorithms announced by the server is set as attributeSERVER_ALGORITHMS
of thesession
.- Parameters:
session
- the message was received forserverAlgorithms
- signature algorithm names announced by the server
-
-