public final class KexExtensions
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLIENT_KEX_EXTENSION |
private static java.util.NavigableMap<java.lang.String,KexExtensionParser<?>> |
EXTENSION_PARSERS
A case insensitive map of all the default known
KexExtensionParser where key=the extension name |
static java.util.function.Predicate<java.lang.String> |
IS_KEX_EXTENSION_SIGNAL |
static java.lang.String |
SERVER_KEX_EXTENSION |
static byte |
SSH_MSG_EXT_INFO |
static byte |
SSH_MSG_NEWCOMPRESS |
Modifier | Constructor and Description |
---|---|
private |
KexExtensions() |
Modifier and Type | Method and Description |
---|---|
static KexExtensionParser<?> |
getRegisteredExtensionParser(java.lang.String name) |
static java.util.NavigableSet<java.lang.String> |
getRegisteredExtensionParserNames() |
static java.util.List<java.util.Map.Entry<java.lang.String,?>> |
parseExtensions(Buffer buffer)
Attempts to parse an
SSH_MSG_EXT_INFO message |
static void |
putExtensions(java.util.Collection<? extends java.util.Map.Entry<java.lang.String,?>> exts,
Buffer buffer)
Creates an
SSH_MSG_EXT_INFO message using the provided extensions. |
static KexExtensionParser<?> |
registerExtensionParser(KexExtensionParser<?> parser)
Registers a
KexExtensionParser for a named extension |
static KexExtensionParser<?> |
unregisterExtensionParser(java.lang.String name)
Registers
KexExtensionParser for a named extension |
public static final byte SSH_MSG_EXT_INFO
public static final byte SSH_MSG_NEWCOMPRESS
public static final java.lang.String CLIENT_KEX_EXTENSION
public static final java.lang.String SERVER_KEX_EXTENSION
public static final java.util.function.Predicate<java.lang.String> IS_KEX_EXTENSION_SIGNAL
private static final java.util.NavigableMap<java.lang.String,KexExtensionParser<?>> EXTENSION_PARSERS
KexExtensionParser
where key=the extension namepublic static java.util.NavigableSet<java.lang.String> getRegisteredExtensionParserNames()
KexExtensionParser
s namespublic static KexExtensionParser<?> getRegisteredExtensionParser(java.lang.String name)
name
- The (never null
/empty) extension nameKexExtensionParser
for the (case insensitive) extension name -
null
if no match foundpublic static KexExtensionParser<?> registerExtensionParser(KexExtensionParser<?> parser)
KexExtensionParser
for a named extensionparser
- The (never null
) parser to registernull
if no
previous parser registered for this extensionpublic static KexExtensionParser<?> unregisterExtensionParser(java.lang.String name)
KexExtensionParser
for a named extensionname
- The (never null
/empty) extension nameKexExtensionParser
for the (case insensitive) extension name -
null
if no match foundpublic static java.util.List<java.util.Map.Entry<java.lang.String,?>> parseExtensions(Buffer buffer) throws java.io.IOException
SSH_MSG_EXT_INFO
messagebuffer
- The Buffer
containing the messageList
of key/value "pairs" where key=the extension name, value=the parsed
value using the matching registered KexExtensionParser
. If no such parser found then
the raw value bytes are set as the extension value.java.io.IOException
- If failed to parse one of the extensionspublic static void putExtensions(java.util.Collection<? extends java.util.Map.Entry<java.lang.String,?>> exts, Buffer buffer) throws java.io.IOException
SSH_MSG_EXT_INFO
message using the provided extensions.exts
- A Collection
of key/value "pairs" where key=the extension name, value=the
extension value. Note: if a registered KexExtensionParser
exists for the name,
then it is assumed that the value is of the correct type. If no registered parser found the
value is assumed to be either the encoded value as an array of bytes or as another
Readable
(e.g., another Buffer
) or a ByteBuffer
.buffer
- The target Buffer
- assumed to already contain the SSH_MSG_EXT_INFO
opcodejava.io.IOException
- If failed to encode