public final class KexExtensions extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_KEX_EXTENSION |
static Predicate<String> |
IS_KEX_EXTENSION_SIGNAL |
static String |
SERVER_KEX_EXTENSION |
static byte |
SSH_MSG_EXT_INFO |
static byte |
SSH_MSG_NEWCOMPRESS |
Modifier and Type | Method and Description |
---|---|
static KexExtensionParser<?> |
getRegisteredExtensionParser(String name) |
static NavigableSet<String> |
getRegisteredExtensionParserNames() |
static List<Map.Entry<String,?>> |
parseExtensions(Buffer buffer)
Attempts to parse an
SSH_MSG_EXT_INFO message |
static void |
putExtensions(Collection<? extends Map.Entry<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(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 String CLIENT_KEX_EXTENSION
public static final String SERVER_KEX_EXTENSION
public static NavigableSet<String> getRegisteredExtensionParserNames()
KexExtensionParser
s namespublic static KexExtensionParser<?> getRegisteredExtensionParser(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(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 List<Map.Entry<String,?>> parseExtensions(Buffer buffer) throws 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.IOException
- If failed to parse one of the extensionspublic static void putExtensions(Collection<? extends Map.Entry<String,?>> exts, Buffer buffer) throws 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
opcodeIOException
- If failed to encodeCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.