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).
-
-
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 DefaultClientKexExtensionHandler
INSTANCE
Default singleton instance.static AttributeRepository.AttributeKey<java.util.Set<java.lang.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, java.lang.String name, byte[] data)
Invoked byKexExtensionHandler.handleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.protected void
handleServerSignatureAlgorithms(Session session, java.util.Collection<java.lang.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, handleKexInitProposal, sendKexExtensions
-
-
-
-
Field Detail
-
INSTANCE
public static final DefaultClientKexExtensionHandler INSTANCE
Default singleton instance.
-
SERVER_ALGORITHMS
public static final AttributeRepository.AttributeKey<java.util.Set<java.lang.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 java.io.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:
java.io.IOException
- If failed to process the request
-
handleKexExtensionRequest
public boolean handleKexExtensionRequest(Session session, int index, int count, java.lang.String name, byte[] data) throws java.io.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:
java.io.IOException
-
handleServerSignatureAlgorithms
protected void handleServerSignatureAlgorithms(Session session, java.util.Collection<java.lang.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
-
-