public class DefaultClientKexExtensionHandler extends AbstractLoggingBean implements KexExtensionHandler
KexExtensionHandler.AvailabilityPhase, KexExtensionHandler.KexPhase
Modifier and Type | Field and Description |
---|---|
static AttributeRepository.AttributeKey<java.util.Map<KexProposalOption,java.lang.String>> |
CLIENT_PROPOSAL_KEY
Session
AttributeRepository.AttributeKey used to store the client's proposal |
static java.util.NavigableSet<java.lang.String> |
DEFAULT_EXTRA_SIGNATURES |
static DefaultClientKexExtensionHandler |
INSTANCE |
static AttributeRepository.AttributeKey<java.util.Map<KexProposalOption,java.lang.String>> |
SERVER_PROPOSAL_KEY
Session
AttributeRepository.AttributeKey used to store the server's proposal |
log
Constructor and Description |
---|
DefaultClientKexExtensionHandler() |
Modifier and Type | Method and Description |
---|---|
boolean |
handleKexExtensionRequest(Session session,
int index,
int count,
java.lang.String name,
byte[] data)
Invoked by
KexExtensionHandler.handleKexExtensionsMessage(Session, Buffer) in order to handle a specific extension. |
void |
handleKexInitProposal(Session session,
boolean initiator,
java.util.Map<KexProposalOption,java.lang.String> proposal)
Invoked when a peer is ready to send the KEX options proposal or has received such a proposal.
|
boolean |
isKexExtensionsAvailable(Session session,
KexExtensionHandler.AvailabilityPhase phase) |
int |
resolvePreferredSignaturePosition(Session session,
java.util.List<? extends NamedFactory<Signature>> factories,
NamedFactory<Signature> factory) |
java.util.List<NamedFactory<Signature>> |
resolveRequestedSignatureFactories(Session session,
java.util.Collection<java.lang.String> extraAlgos) |
NamedFactory<Signature> |
resolveRequestedSignatureFactory(Session session,
java.lang.String name) |
java.util.List<NamedFactory<Signature>> |
resolveUpdatedSignatureFactories(Session session,
java.util.List<NamedFactory<Signature>> available,
java.util.Collection<java.lang.String> extraAlgos)
Checks if the extra signature algorithms are already included in the available ones, and adds the extra ones (if
supported).
|
java.util.List<NamedFactory<Signature>> |
updateAvailableSignatureFactories(Session session,
java.util.Collection<java.lang.String> extraAlgos) |
java.util.List<NamedFactory<Signature>> |
updateAvailableSignatureFactories(Session session,
java.util.List<NamedFactory<Signature>> available,
java.util.Collection<? extends NamedFactory<Signature>> toAdd) |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handleKexCompressionMessage, handleKexExtensionNegotiation, handleKexExtensionsMessage, sendKexExtensions
public static final AttributeRepository.AttributeKey<java.util.Map<KexProposalOption,java.lang.String>> CLIENT_PROPOSAL_KEY
AttributeRepository.AttributeKey
used to store the client's proposalpublic static final AttributeRepository.AttributeKey<java.util.Map<KexProposalOption,java.lang.String>> SERVER_PROPOSAL_KEY
AttributeRepository.AttributeKey
used to store the server's proposalpublic static final java.util.NavigableSet<java.lang.String> DEFAULT_EXTRA_SIGNATURES
public static final DefaultClientKexExtensionHandler INSTANCE
public boolean isKexExtensionsAvailable(Session session, KexExtensionHandler.AvailabilityPhase phase) throws java.io.IOException
isKexExtensionsAvailable
in interface KexExtensionHandler
session
- The Session
about to execute KEXphase
- The KexExtensionHandler.AvailabilityPhase
hint as to why the query is being madetrue
whether to KEX extensions are supported/allowed for the sessionjava.io.IOException
- If failed to process the requestpublic void handleKexInitProposal(Session session, boolean initiator, java.util.Map<KexProposalOption,java.lang.String> proposal) throws java.io.IOException
KexExtensionHandler
isKexExtensionsAvailable
returns false
for
the session.handleKexInitProposal
in interface KexExtensionHandler
session
- The Session
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 before being sent or before being processed (if incoming)java.io.IOException
- If failed to handle the requestpublic boolean handleKexExtensionRequest(Session session, int index, int count, java.lang.String name, byte[] data) throws java.io.IOException
KexExtensionHandler
KexExtensionHandler.handleKexExtensionsMessage(Session, Buffer)
in order to handle a specific extension.handleKexExtensionRequest
in interface KexExtensionHandler
session
- The Session
through which the message was receivedindex
- The 0-based extension indexcount
- The total extensions in the messagename
- The extension namedata
- The extension datatrue
whether to proceed to the next extension or stop processing the restjava.io.IOException
- If failed to handle the extensionpublic java.util.List<NamedFactory<Signature>> updateAvailableSignatureFactories(Session session, java.util.Collection<java.lang.String> extraAlgos) throws java.io.IOException
java.io.IOException
public java.util.List<NamedFactory<Signature>> resolveUpdatedSignatureFactories(Session session, java.util.List<NamedFactory<Signature>> available, java.util.Collection<java.lang.String> extraAlgos) throws java.io.IOException
session
- The Session
for which the resolution occursavailable
- The available signature factoriesextraAlgos
- The extra requested signatures - ignored if null
/emptyjava.io.IOException
- If failed to resolve the factoriespublic java.util.List<NamedFactory<Signature>> updateAvailableSignatureFactories(Session session, java.util.List<NamedFactory<Signature>> available, java.util.Collection<? extends NamedFactory<Signature>> toAdd) throws java.io.IOException
java.io.IOException
public int resolvePreferredSignaturePosition(Session session, java.util.List<? extends NamedFactory<Signature>> factories, NamedFactory<Signature> factory) throws java.io.IOException
java.io.IOException
public java.util.List<NamedFactory<Signature>> resolveRequestedSignatureFactories(Session session, java.util.Collection<java.lang.String> extraAlgos) throws java.io.IOException
java.io.IOException
public NamedFactory<Signature> resolveRequestedSignatureFactory(Session session, java.lang.String name) throws java.io.IOException
java.io.IOException