extensions = new LinkedHashMap<>();
+ collectExtensions(session, phase, extensions::put);
+ if (!extensions.isEmpty()) {
+ Buffer buffer = session.createBuffer(KexExtensions.SSH_MSG_EXT_INFO);
+ KexExtensions.putExtensions(extensions.entrySet(), buffer);
+ if (log.isDebugEnabled()) {
+ log.debug("sendKexExtensions({})[{}]: sending SSH_MSG_EXT_INFO with {} info records", session, phase,
+ extensions.size());
+ }
+ session.writePacket(buffer);
+ }
+ }
+
+ /**
+ * Collects extension info records, handing them off to the given {@code marshaller} for writing into an
+ * {@link KexExtensions#SSH_MSG_EXT_INFO} message.
+ *
+ * This default implementation does not marshal any extension.
+ *
+ *
+ * @param session {@link Session} to send the KEX extension information for
+ * @param phase {@link KexPhase} of the SSH protocol
+ * @param marshaller {@link BiConsumer} writing the extensions into an SSH message
+ */
+ public void collectExtensions(Session session, KexPhase phase, BiConsumer marshaller) {
+ // ext-info-in-auth@openssh.com
+ marshaller.accept(ExtInfoInAuth.NAME, "");
+ }
}