<?xml version='1.0' encoding='UTF-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" docName="draft-liu-sshm-kem-userauth-00" ipr="trust200902" submissionType="IETF" consensus="true">
  <front>
    <title>KEM-based User Authentication for SSH</title>
    <seriesInfo name="Internet-Draft" value="draft-liu-sshm-kem-userauth-00"/>
    <author fullname="Hongbo Liu" initials="H." surname="Liu">
      <organization abbrev="Institute of Information Engineering, CAS">Institute of Information Engineering, Chinese Academy of Sciences</organization>
      <address>
        <email>liuhongbo@iie.ac.cn</email>
      </address>
    </author>
    <author fullname="Qionglu Zhang" initials="Q." surname="Zhang">
      <organization abbrev="Institute of Information Engineering, CAS">Institute of Information Engineering, Chinese Academy of Sciences</organization>
      <address>
        <email>zhangqionglu@iie.ac.cn</email>
      </address>
    </author>
    <author fullname="Zhaoxuan Li" initials="Z." surname="Li">
      <organization abbrev="Institute of Information Engineering, CAS">Institute of Information Engineering, Chinese Academy of Sciences</organization>
      <address>
        <email>lizhaoxuan@iie.ac.cn</email>
      </address>
    </author>
    <author fullname="Yufan Su" initials="Y." surname="Su">
      <organization>North China Electric Power University</organization>
      <address>
        <email>120262127028@ncepu.edu.cn</email>
      </address>
    </author>
    <author fullname="Xianhui Lu" initials="X." surname="Lu">
      <organization abbrev="Institute of Information Engineering, CAS">Institute of Information Engineering, Chinese Academy of Sciences</organization>
      <address>
        <email>luxianhui@iie.ac.cn</email>
      </address>
    </author>
    <keyword>SSH</keyword>
    <keyword>KEM</keyword>
    <keyword>user authentication</keyword>
    <abstract>
      <t>This document specifies <tt>publickey-kem</tt>, a Key Encapsulation Mechanism (KEM)-based user authentication method for the Secure Shell (SSH) protocol. The server encapsulates a fresh shared secret to an authorized client public key. The client demonstrates possession of the corresponding private key by returning a session-bound confirmation value. The method does not modify SSH transport or server host authentication. Initial authentication algorithm profiles using ML-KEM and HMAC-SHA256 are also specified.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="sec-1">
      <name>Introduction</name>
      <t>SSH separates transport-layer security <xref target="RFC4253"/> from user authentication <xref target="RFC4252"/> and the connection protocol <xref target="RFC4254"/>. The widely used <tt>publickey</tt> user authentication method proves possession of an authorized private key through a digital signature. Post-quantum signature algorithms can be accommodated by that method <xref target="I-D.sfluhrer-ssh-mldsa"/>, while a KEM provides a different means of proving possession. A server encapsulates a secret to an authorized public key, and the client demonstrates knowledge of the corresponding secret through decapsulation and key confirmation.</t>
      <t>This document defines <tt>publickey-kem</tt> as a separate SSH user authentication method. It preserves SSH's public-key credential and authorization model while replacing the client signature with a challenge-response confirmation bound to the SSH session and authentication request. The method introduces no transport-layer changes and can coexist with other SSH authentication methods. It builds on the KEMUAuth construction described in <xref target="KEMUAuth"/>.</t>
      <t>KEM-based authentication has also been studied for TLS and EDHOC <xref target="KEMTLS"/> <xref target="I-D.celi-wiggers-tls-authkem"/> <xref target="I-D.ietf-lake-authkem-edhoc"/>. The method defined here is independent of the choice of KEM and confirmation function. Section 5 specifies initial authentication algorithm profiles using ML-KEM <xref target="FIPS203"/> and HMAC-SHA256. Additional profiles can be defined within the same authentication method.</t>
      <t>This specification concerns SSH client user authentication. SSH transport-layer migration mechanisms, including <xref target="RFC9941"/> and <xref target="RFC10042"/>, are defined separately.</t>
    </section>
    <section anchor="sec-2">
      <name>Conventions and Terminology</name>
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>
      <t>SSH data types, including <tt>byte</tt>, <tt>string</tt>, and <tt>name-list</tt>, follow <xref target="RFC4251"/>. <tt>SSH_string(x)</tt> denotes the SSH <tt>string</tt> encoding of the octet sequence <tt>x</tt>, consisting of a four-octet length in network byte order followed by <tt>x</tt>. A <tt>string</tt> carrying a public key blob includes its own length prefix, independently of the SSH-encoded fields inside the blob.</t>
      <t>A Key Encapsulation Mechanism (KEM) provides three algorithms.</t>
      <sourcecode type="text">(pk_C, sk_C) = KeyGen()
(K_C, ct_C)  = Encap(pk_C)
K_C'         = Decap(sk_C, ct_C)</sourcecode>
      <t><tt>KeyGen</tt> produces a public encapsulation key and a corresponding private decapsulation key. <tt>Encap</tt> produces a shared secret and a ciphertext using the public key. <tt>Decap</tt> recovers the shared secret using the private key and ciphertext. For honestly generated keys and encapsulations, correctness requires <tt>K_C' = K_C</tt>, except with any permitted correctness error specified by the KEM. Profile-specific input validation and decapsulation behavior are defined by the selected algorithm profile.</t>
      <t>The following notation is used throughout this document.</t>
      <ul spacing="normal">
        <li>
          <t><tt>pk_C</tt> and <tt>sk_C</tt> denote the client's long-term KEM encapsulation and decapsulation keys.</t>
        </li>
        <li>
          <t><tt>ct_C</tt> denotes the KEM ciphertext produced for a single authentication attempt.</t>
        </li>
        <li>
          <t><tt>K_C</tt> denotes the shared secret produced by the server's encapsulation. The client recovers the corresponding secret by decapsulation; in the normal exchange both parties use the same <tt>K_C</tt>.</t>
        </li>
        <li>
          <t><tt>sid</tt> denotes the SSH session identifier established by the first transport-layer key exchange <xref target="RFC4253"/>.</t>
        </li>
        <li>
          <t><tt>alg</tt> denotes the complete authentication algorithm identifier, which selects the KEM, confirmation function, and profile parameters.</t>
        </li>
        <li>
          <t><tt>public_key_blob</tt> denotes the SSH-encoded public key object, beginning with its public key format identifier.</t>
        </li>
        <li>
          <t><tt>Confirm_alg</tt> denotes the confirmation function selected by <tt>alg</tt>.</t>
        </li>
        <li>
          <t><tt>label</tt> denotes the domain-separation octets defined in Section 4.2. <tt>ctx</tt> denotes the encoded authentication context, and <tt>MAC_input</tt> denotes the complete input to <tt>Confirm_alg</tt>.</t>
        </li>
        <li>
          <t><tt>ca</tt> denotes the client authentication value.</t>
        </li>
      </ul>
      <t>An authentication attempt is one execution of <tt>publickey-kem</tt>, from its initial request to completion or abandonment. An authorized key is one permitted by server policy for the requested user and service. A valid KEM public key is not necessarily authorized.</t>
    </section>
    <section anchor="sec-3">
      <name>KEM-based User Authentication</name>
      <section anchor="sec-3-1">
        <name>Method Overview</name>
        <t>The client holds a long-term KEM private key, and the server associates the corresponding public key with an SSH user. After receiving a <tt>publickey-kem</tt> request, the server validates the selected algorithm and public key, checks authorization, and encapsulates a fresh shared secret. The client checks the challenge, decapsulates the ciphertext, and returns a confirmation value bound to the SSH session and the authentication attempt. The server verifies the response and applies the normal SSH authentication result rules.</t>
        <figure anchor="fig-method-exchange">
          <name>KEM-based SSH user authentication exchange</name>
          <artwork type="ascii-art">      Client                                                  Server
       |                                                            |
       | SSH_MSG_USERAUTH_REQUEST (50)                              |
       | user, service, "publickey-kem", alg, public_key_blob       |
       |------------------------------------------------------------&gt;
       |                  Validate algorithm, key and authorization |
       |                                  (K_C, ct_C) = Encap(pk_C) |
       |                                                            |
       |                        SSH_MSG_USERAUTH_KEM_CHALLENGE (60) |
       |                                 alg, public_key_blob, ct_C |
       &lt;------------------------------------------------------------|
       | Check echoes and ciphertext                                |
       | K_C = Decap(sk_C, ct_C)                                    |
       | ca = Confirm_alg(K_C, MAC_input)                           |
       |                                                            |
       | SSH_MSG_USERAUTH_KEM_RESPONSE (61)                         |
       | ca                                                         |
       |------------------------------------------------------------&gt;
       |                         Verify ca and authorization policy |
       |                                                            |
       |                         SSH_MSG_USERAUTH_SUCCESS / FAILURE |
       &lt;------------------------------------------------------------|</artwork>
        </figure>
        <t>Failure may occur before or after the challenge. All messages are carried inside the protected SSH transport channel.</t>
        <t>The KEM shared secret is used for client authentication and is not incorporated into SSH transport key derivation. The SSH transport key exchange and KEM user authentication algorithms are selected independently. Since the server also knows the shared secret, the confirmation value is not a transferable client signature.</t>
      </section>
      <section anchor="sec-3-2">
        <name>Authentication Algorithm Profiles</name>
        <t>An authentication algorithm profile specifies a KEM, a public key format, the ciphertext representation, a confirmation function and output length, and any required cryptographic validation. The <tt>alg</tt> field identifies the complete profile. KEM and confirmation functions are not negotiated separately.</t>
        <t>The public key format identifier is distinct from the authentication algorithm identifier. Different authentication algorithms <bcp14>MAY</bcp14> share a public key format when their profiles explicitly permit it. Each profile <bcp14>MUST</bcp14> define the information required for independent implementations to encode, process, and verify an authentication attempt.</t>
      </section>
    </section>
    <section anchor="sec-4">
      <name>Protocol Specification</name>
      <section anchor="sec-4-1">
        <name>Messages and Encodings</name>
        <t>The <tt>publickey-kem</tt> method uses the SSH user authentication framework of <xref target="RFC4252"/> and defines two method-specific messages. <tt>SSH_MSG_USERAUTH_KEM_CHALLENGE</tt> (60) is sent by the server, and <tt>SSH_MSG_USERAUTH_KEM_RESPONSE</tt> (61) is sent by the client. The numbers are interpreted within the active authentication method. Section 6 of <xref target="RFC4252"/> describes method-specific messages as server-to-client, while <xref target="RFC4256"/> defines the client-to-server <tt>SSH_MSG_USERAUTH_INFO_RESPONSE</tt> using number 61. This method follows that established precedent for a client response.</t>
        <t>The client begins an authentication attempt with the following request.</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_REQUEST        /* 50 */
string    user name
string    service name
string    "publickey-kem"
string    authentication algorithm
string    public key blob</sourcecode>
        <t>The authentication algorithm identifies the complete profile. The public key blob is an SSH-encoded object containing the public key format identifier followed by the profile-specific key fields. The request contains no <tt>publickey</tt> signature-probe boolean.</t>
        <t>The server checks that it supports and permits the algorithm, that the public key encoding is valid for the selected profile, and that the credential is authorized for the requested user and service. If a check fails, the server rejects the request using <tt>SSH_MSG_USERAUTH_FAILURE</tt>. Otherwise, it performs <tt>(K_C, ct_C) = Encap(pk_C)</tt> and sends the following challenge.</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_KEM_CHALLENGE  /* 60 */
string    authentication algorithm
string    public key blob
string    KEM ciphertext</sourcecode>
        <t>The algorithm and public key blob in the challenge <bcp14>MUST</bcp14> be byte-for-byte identical to those in the request. The ciphertext is encoded as an SSH <tt>string</tt> containing the ciphertext representation specified by the selected profile. Each challenge <bcp14>MUST</bcp14> use a fresh encapsulation. The server <bcp14>MUST NOT</bcp14> reuse a challenge and its shared secret for a different authentication attempt.</t>
        <t>The client <bcp14>MUST</bcp14> verify that the challenge corresponds to its pending request and that both echoed fields match exactly. It <bcp14>MUST</bcp14> apply the ciphertext input checks required by the profile before decapsulation. If these checks succeed, it decapsulates using the associated private key and sends the following response.</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_KEM_RESPONSE   /* 61 */
string    authentication value</sourcecode>
        <t>The authentication value is <tt>ca</tt> as defined in Section 4.2. The response does not repeat the user, service, or key fields. They are taken from the pending request and challenge. All on-wire algorithm and public key format identifiers are case-sensitive. The <tt>publickey-kem</tt> request, challenge, and response formats above contain no extension fields. Implementations <bcp14>MUST</bcp14> reject these messages if they contain unexpected trailing octets. Error handling follows Section 4.3.</t>
        <t>The server completes the attempt using the existing SSH user authentication result messages <xref target="RFC4252"/>.</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_FAILURE        /* 51 */
name-list authentications that can continue
boolean   partial success</sourcecode>
        <t>or</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_SUCCESS        /* 52 */</sourcecode>
        <t>The interpretation of these results, including partial success, is defined by <xref target="RFC4252"/>. This method defines no additional result message.</t>
      </section>
      <section anchor="sec-4-2">
        <name>Confirmation Input and Verification</name>
        <t>After completing the selected KEM decapsulation procedure, the client computes the authentication value as follows.</t>
        <sourcecode type="text">ca        = Confirm_alg(K_C, MAC_input)
MAC_input = label || SSH_string(sid) || ctx</sourcecode>
        <t>The <tt>label</tt> is the raw US-ASCII octet sequence <tt>ssh-publickey-kem-client-auth</tt>, without a trailing NUL or an SSH <tt>string</tt> length prefix. The <tt>sid</tt> is encoded as one SSH <tt>string</tt>. It is the session identifier established by the first SSH key exchange and does not change following transport rekeying <xref target="RFC4253"/>.</t>
        <t>The context <tt>ctx</tt> is the concatenation of the following fields in exactly this order, using SSH binary encoding <xref target="RFC4251"/>.</t>
        <sourcecode type="text">byte      SSH_MSG_USERAUTH_REQUEST        /* 50 */
string    user name
string    service name
string    "publickey-kem"
string    authentication algorithm
string    public key blob

byte      SSH_MSG_USERAUTH_KEM_CHALLENGE  /* 60 */
string    authentication algorithm
string    public key blob
string    KEM ciphertext

byte      SSH_MSG_USERAUTH_KEM_RESPONSE   /* 61 */</sourcecode>
        <t>The request and challenge portions of <tt>ctx</tt> contain exactly the transmitted SSH field values, including the outer <tt>string</tt> encoding of the public key blob and its inner encoded fields. The final byte is the response message type 61. The response's authentication value is excluded. SSH packet lengths, transport padding, packet sequence numbers, and transport authentication tags are also excluded. No additional normalization, separators, or encoding are applied.</t>
        <t>The server computes the expected authentication value using the shared secret generated by its encapsulation and the request and challenge fields associated with the pending attempt. The server <bcp14>MUST</bcp14> verify that the response belongs to that attempt, has the profile's required length, and equals the expected value. Fixed-length secret confirmation values <bcp14>MUST</bcp14> be compared in constant time. The credential <bcp14>MUST</bcp14> still be authorized when the server accepts the authentication.</t>
        <t>For the ML-KEM profiles of Section 5, <tt>Confirm_alg</tt> is HMAC-SHA256. The ML-KEM shared secret is used directly as the HMAC key, and the entire 32-octet output is <tt>ca</tt>.</t>
      </section>
      <section anchor="sec-4-3">
        <name>State, Failure, and Completion</name>
        <t>The server <bcp14>MUST</bcp14> bind each pending challenge to the user, service, authentication algorithm, exact public key blob, ciphertext, and the shared secret or expected confirmation value needed for verification. The server <bcp14>MUST</bcp14> maintain no more than one outstanding challenge for the active <tt>publickey-kem</tt> attempt. A KEM response received without a corresponding pending challenge <bcp14>MUST NOT</bcp14> be accepted as authentication.</t>
        <t>The following rules apply to an attempt.</t>
        <table>
          <name>Authentication Attempt State and Failure Handling</name>
          <thead>
            <tr>
              <th>Condition</th>
              <th>Handling</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>Unsupported algorithm, invalid key encoding, or unauthorized credential</td>
              <td>Reject the initial request without encapsulation.</td>
            </tr>
            <tr>
              <td>Challenge echoes do not match, or ciphertext fails required client-side input checks</td>
              <td>The client <bcp14>MUST NOT</bcp14> send a KEM response for that challenge.</td>
            </tr>
            <tr>
              <td>Authentication value has the wrong length or fails verification</td>
              <td>Reject the attempt using <tt>SSH_MSG_USERAUTH_FAILURE</tt> with <tt>partial success</tt> set to FALSE.</td>
            </tr>
            <tr>
              <td>A new <tt>SSH_MSG_USERAUTH_REQUEST</tt> interrupts the pending challenge</td>
              <td>Abandon the pending attempt and process the new request under <xref target="RFC4252"/>. Do not send a failure response solely for the aborted attempt.</td>
            </tr>
            <tr>
              <td>A KEM response arrives without an active <tt>publickey-kem</tt> challenge</td>
              <td>Treat as a protocol-state error. The server <bcp14>SHOULD</bcp14> disconnect and <bcp14>MUST NOT</bcp14> authenticate the client.</td>
            </tr>
          </tbody>
        </table>
        <t>The protocol-state error rules above apply while SSH user authentication is in progress. After sending <tt>SSH_MSG_USERAUTH_SUCCESS</tt>, the server <bcp14>SHOULD</bcp14> silently ignore subsequent authentication-related messages, as specified in Section 5.3 of <xref target="RFC4252"/>.</t>
        <t>Clients and servers <bcp14>MUST</bcp14> follow the request sequencing and interruption rules of <xref target="RFC4252"/>. In particular, a client can abandon an interactive authentication exchange by starting another request as permitted by that specification. The server <bcp14>MUST</bcp14> discard the old challenge when that happens. When the user name or service name changes, the server <bcp14>MUST</bcp14> also clear accumulated authentication state, or disconnect if it cannot, as required by <xref target="RFC4252"/>.</t>
        <t>A challenge is consumed when its response has been processed, regardless of whether verification succeeds. A consumed challenge <bcp14>MUST NOT</bcp14> be accepted again. Pending challenge state <bcp14>MUST</bcp14> be discarded following completion, abandonment, authentication timeout, or connection termination. Secret intermediate values <bcp14>SHOULD</bcp14> be erased when no longer needed.</t>
        <t>If <tt>publickey-kem</tt> succeeds and no other factor is required, the server sends <tt>SSH_MSG_USERAUTH_SUCCESS</tt>. If this method succeeds but additional authentication is required, the server sends <tt>SSH_MSG_USERAUTH_FAILURE</tt> with <tt>partial success</tt> set to TRUE. A failed <tt>publickey-kem</tt> attempt uses <tt>partial success</tt> FALSE. These results follow <xref target="RFC4252"/>.</t>
        <t>Malformed method-specific payloads and recognized messages received in an invalid authentication state <bcp14>MUST NOT</bcp14> result in successful authentication. A malformed payload may be treated as a protocol error. Handling of truly unrecognized SSH message numbers follows the applicable <tt>SSH_MSG_UNIMPLEMENTED</tt> rules of <xref target="RFC4253"/>.</t>
        <t>For profiles with implicit rejection, decapsulation <bcp14>MUST</bcp14> follow the selected KEM specification. No internal decapsulation consistency outcome is sent as a separate SSH error. Subsequent confirmation failures use the normal authentication failure rules. The method introduces no KEM-specific failure message.</t>
      </section>
    </section>
    <section anchor="sec-5">
      <name>ML-KEM Authentication Profiles</name>
      <section anchor="sec-5-1">
        <name>Algorithms and Parameters</name>
        <t>This section instantiates <tt>publickey-kem</tt> using ML-KEM <xref target="FIPS203"/> and HMAC-SHA256 <xref target="RFC2104"/> <xref target="FIPS180-4"/>. The following authentication algorithms and public key formats are defined.</t>
        <table anchor="mlkem-authentication-profiles">
          <name>ML-KEM Authentication Algorithm Profiles</name>
          <thead>
            <tr>
              <th>KEM</th>
              <th>Authentication algorithm</th>
              <th>Public key format</th>
              <th>Public key (octets)</th>
              <th>Ciphertext (octets)</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>ML-KEM-512</td>
              <td>
                <tt>ssh-mlkem-512-hmac-sha256</tt>
              </td>
              <td>
                <tt>ssh-mlkem-512</tt>
              </td>
              <td>800</td>
              <td>768</td>
            </tr>
            <tr>
              <td>ML-KEM-768</td>
              <td>
                <tt>ssh-mlkem-768-hmac-sha256</tt>
              </td>
              <td>
                <tt>ssh-mlkem-768</tt>
              </td>
              <td>1184</td>
              <td>1088</td>
            </tr>
            <tr>
              <td>ML-KEM-1024</td>
              <td>
                <tt>ssh-mlkem-1024-hmac-sha256</tt>
              </td>
              <td>
                <tt>ssh-mlkem-1024</tt>
              </td>
              <td>1568</td>
              <td>1568</td>
            </tr>
          </tbody>
        </table>
        <t>The table gives raw FIPS 203 encapsulation-key and ciphertext sizes, excluding SSH field-length prefixes. Every profile uses a 32-octet ML-KEM shared secret and a 32-octet confirmation value. Implementations of <tt>publickey-kem</tt> <bcp14>SHOULD</bcp14> support ML-KEM-768 and <bcp14>MAY</bcp14> also support ML-KEM-512 or ML-KEM-1024. These requirements do not define automatic algorithm selection or preference ordering.</t>
        <t>Each authentication algorithm identifies its ML-KEM parameter set, public key format, and HMAC-SHA256 confirmation function. An implementation <bcp14>MUST NOT</bcp14> substitute a different KEM parameter set or confirmation function under the same authentication algorithm name. The public key format <bcp14>MUST</bcp14> match the selected algorithm.</t>
      </section>
      <section anchor="sec-5-2">
        <name>Public Keys and Ciphertexts</name>
        <t>The <tt>public key blob</tt> field of Section 4.1 contains an SSH-encoded object with exactly the following internal fields.</t>
        <sourcecode type="text">string    public key format identifier
string    ML-KEM encapsulation key</sourcecode>
        <t>The first field contains the public key format identifier from Section 5.1. The second contains the raw ML-KEM encapsulation key specified by <xref target="FIPS203"/>. Extra fields and trailing octets are not permitted. The complete two-field object is carried as the contents of the outer <tt>string public key blob</tt> field in the authentication request and challenge.</t>
        <t>The server <bcp14>MUST</bcp14> ensure that an ML-KEM encapsulation key satisfies the input checks of Section 7.2 of <xref target="FIPS203"/> before encapsulation. Key validation <bcp14>MAY</bcp14> be performed when the credential is provisioned, provided the result remains associated with the same unmodified key. Authorization for the user and service is a separate requirement.</t>
        <t>The challenge ciphertext is the raw output of <tt>ML-KEM.Encaps</tt>, with the length specified in Section 5.1. The client <bcp14>MUST</bcp14> ensure that its decapsulation key has passed the required input checks of Section 7.3 of <xref target="FIPS203"/>. A previously validated key need not be revalidated when its integrity is maintained.</t>
        <t>The client <bcp14>MUST</bcp14> check the ciphertext length on every decapsulation attempt and <bcp14>MUST</bcp14> reject a ciphertext with an incorrect length. For a correctly sized ciphertext and a validated decapsulation key, the client runs <tt>ML-KEM.Decaps</tt> according to <xref target="FIPS203"/>, including implicit rejection. No separate implicit-rejection indicator is transmitted in SSH.</t>
      </section>
      <section anchor="sec-5-3">
        <name>Confirmation Function</name>
        <t>For each profile in this section, the confirmation function is defined as follows.</t>
        <sourcecode type="text">K_C = 32-octet ML-KEM shared secret
ca  = HMAC-SHA256(K_C, MAC_input)</sourcecode>
        <t><tt>MAC_input</tt> is specified in Section 4.2. The ML-KEM shared secret is used directly as the HMAC-SHA256 key without an additional hash or key derivation step, consistent with key-confirmation guidance in <xref target="NIST-SP-800-227"/>. The complete 32-octet output is encoded as the contents of the <tt>string authentication value</tt> field.</t>
        <t>The shared secret is used solely for this authentication confirmation. Neither the secret nor the authentication value enters SSH transport key derivation.</t>
        <t>Additional authentication algorithm profiles <bcp14>MAY</bcp14> specify other KEMs or confirmation functions. Each new profile <bcp14>MUST</bcp14> specify key and ciphertext encodings, validation rules, the exact confirmation computation, and the confirmation output length. The protocol messages and state rules of Section 4 remain unchanged unless another specification explicitly extends them.</t>
      </section>
    </section>
    <section anchor="sec-6">
      <name>Deployment and Interoperability</name>
      <t>SSH clients and servers can deploy <tt>publickey-kem</tt> alongside existing authentication methods. Servers associate authorized KEM public keys with users according to local policy. The public key encoding is defined in Section 5, while credential provisioning and storage are implementation-specific. SSH certificate and agent integrations are outside the scope of this specification.</t>
      <t>Servers can advertise <tt>publickey-kem</tt> in the <tt>authentications that can continue</tt> list of <xref target="RFC4252"/>. This list contains authentication method names, not the KEM authentication algorithms of Section 5. A client selects an algorithm for which it holds a corresponding private key, and the server checks support and authorization upon receiving the request. The <tt>server-sig-algs</tt> extension of <xref target="RFC8308"/> describes algorithms accepted for the <tt>publickey</tt> authentication method and does not negotiate <tt>publickey-kem</tt> profiles.</t>
      <t>The <tt>publickey-kem</tt> method can serve as one factor in multi-method authentication. Servers can require it together with <tt>publickey</tt>, <tt>password</tt>, or other methods using the policy and partial-success mechanisms of <xref target="RFC4252"/>.</t>
      <t>A server that does not support <tt>publickey-kem</tt> rejects that method through the normal SSH authentication mechanism. Clients and servers configured to require KEM-based authentication <bcp14>MUST NOT</bcp14> bypass that requirement by falling back to a disallowed method. Section 7.3 discusses the associated downgrade considerations.</t>
    </section>
    <section anchor="sec-7">
      <name>Security Considerations</name>
      <section anchor="sec-7-1">
        <name>Authentication and Cryptographic Assumptions</name>
        <t>The <tt>publickey-kem</tt> method relies on an authorized long-term KEM public key, unambiguous confirmation input encoding, and an authenticated, integrity-protected SSH transport channel. The initial profiles use ML-KEM <xref target="FIPS203"/> and HMAC-SHA256 <xref target="RFC2104"/>.</t>
        <t>Under the cryptographic assumptions established in <xref target="KEMUAuth"/>, the KEMUAuth construction achieves mutual authentication security in the ACCE model against classical adversaries. The result also holds against quantum adversaries when the required assumptions are satisfied in the post-quantum setting. These assumptions include an IND-CCA-secure client KEM, a secure authentication PRF, and the required security of SSH transport key exchange, server host authentication, key derivation, and channel protection. The proof builds on the SSH ACCE analysis in <xref target="PQ-SSH-ACCE"/> and addresses protocol-level security rather than implementation-level risks such as side-channel attacks.</t>
        <t>The confirmation input binds the proof to the SSH session identifier and the exact user, service, algorithm, public key, and KEM challenge of the authentication attempt. Fresh encapsulation and one-time challenge handling prevent a recorded response from being reused as a valid response to a different challenge. The server <bcp14>MUST</bcp14> verify both the confirmation value and the credential's authorization before accepting the method.</t>
        <t>Exposure of the client's long-term decapsulation key can enable impersonation while the matching public key remains authorized. The confirmation secret is not used as a transport key. Confidentiality, forward secrecy, and post-quantum protection of the SSH channel depend on the negotiated transport and host-authentication mechanisms rather than on <tt>publickey-kem</tt> alone.</t>
      </section>
      <section anchor="sec-7-2">
        <name>Privacy, Deniability, and Resource Use</name>
        <t>The server also knows the encapsulated shared secret and can compute the same confirmation value as the client. The value is therefore not a publicly verifiable client signature and does not provide transferable proof of client origin.</t>
        <t>A server's decision to issue a challenge can reveal whether a supplied public key is authorized for a user. The existing <tt>publickey</tt> method permits a similar key-acceptability query <xref target="RFC4252"/>. This method does not conceal key authorization status. Servers <bcp14>SHOULD</bcp14> bound authentication attempts, encapsulation work, and pending-state lifetime, consistent with the limits and timeout guidance in <xref target="RFC4252"/>. Failure diagnostics should avoid disclosing unnecessary account and credential information.</t>
        <t>Implementations of the ML-KEM profiles <bcp14>MUST</bcp14> preserve the input-validation and implicit-rejection behavior of <xref target="FIPS203"/>. Constant-time confirmation comparison is required by Section 4.2. These cryptographic handling rules do not themselves prevent account or credential enumeration caused by distinguishable authorization responses.</t>
      </section>
      <section anchor="sec-7-3">
        <name>Migration and Downgrade</name>
        <t>The <tt>publickey-kem</tt> method can coexist with existing SSH authentication methods. The security of the resulting deployment depends on the authentication methods and combinations the server accepts. A policy accepting either KEM-based authentication or a different method permits the latter even when KEM authentication is available.</t>
        <t>User authentication messages are sent inside the established SSH transport channel. The algorithm identifier is checked against the challenge and included in the confirmation input. These bindings prevent an attacker who cannot compromise the protected channel from silently substituting a different algorithm during a valid <tt>publickey-kem</tt> attempt. They do not by themselves select the strongest available algorithm or prohibit a separate authentication attempt using another method.</t>
        <t>Clients and servers configured to require <tt>publickey-kem</tt> or a particular authentication algorithm <bcp14>MUST NOT</bcp14> weaken that requirement merely because it is unavailable. Servers <bcp14>MUST</bcp14> enforce all locally required authentication factors. The security of the transport key exchange and host authentication remains governed by the algorithms and policies for those layers.</t>
      </section>
    </section>
    <section anchor="sec-8">
      <name>IANA Considerations</name>
      <t>This document requests that IANA register <tt>publickey-kem</tt> in the SSH "Authentication Method Names" registry, with this document as its reference.</t>
      <t>The following entries are proposed for the SSH "Public Key Algorithm Names" registry.</t>
      <table>
        <name>Proposed Public Key Algorithm Registrations</name>
        <thead>
          <tr>
            <th>Public Key Algorithm Name</th>
            <th>Public Key Format</th>
            <th>Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>
              <tt>ssh-mlkem-512-hmac-sha256</tt>
            </td>
            <td>
              <tt>ssh-mlkem-512</tt>
            </td>
            <td>This document</td>
          </tr>
          <tr>
            <td>
              <tt>ssh-mlkem-768-hmac-sha256</tt>
            </td>
            <td>
              <tt>ssh-mlkem-768</tt>
            </td>
            <td>This document</td>
          </tr>
          <tr>
            <td>
              <tt>ssh-mlkem-1024-hmac-sha256</tt>
            </td>
            <td>
              <tt>ssh-mlkem-1024</tt>
            </td>
            <td>This document</td>
          </tr>
        </tbody>
      </table>
      <t>These names designate the KEM user-authentication profiles of Section 5, rather than SSH transport key-exchange methods or signature algorithms. The registration policies are specified by <xref target="RFC4250"/> as updated by <xref target="RFC9519"/>.</t>
      <aside>
        <t>Open issue: The suitability of the existing "Public Key Algorithm Names" registry for KEM user-authentication profiles remains open for discussion. Feedback from the SSHM working group and IANA designated experts would be welcome. The proposed algorithm identifiers and registration location remain provisional.</t>
      </aside>
      <t>The challenge and response use message numbers 60 and 61 within the existing user-authentication method-specific message space <xref target="RFC4251"/> <xref target="RFC4256"/>. No new global SSH message number allocation is requested.</t>
      <t>HMAC-SHA256 is part of the authentication profiles defined here and is not an SSH transport MAC algorithm. No entry in the "MAC Algorithm Names" registry is requested.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
        </front>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="BCP" value="14"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
        </front>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="BCP" value="14"/>
      </reference>
      <reference anchor="RFC4250" target="https://www.rfc-editor.org/info/rfc4250">
        <front>
          <title>The Secure Shell (SSH) Protocol Assigned Numbers</title>
          <author fullname="S. Lehtinen" initials="S." surname="Lehtinen"/>
          <author fullname="C. Lonvick" initials="C." surname="Lonvick"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4250"/>
      </reference>
      <reference anchor="RFC4251" target="https://www.rfc-editor.org/info/rfc4251">
        <front>
          <title>The Secure Shell (SSH) Protocol Architecture</title>
          <author fullname="T. Ylonen" initials="T." surname="Ylonen"/>
          <author fullname="C. Lonvick" initials="C." surname="Lonvick"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4251"/>
      </reference>
      <reference anchor="RFC4252" target="https://www.rfc-editor.org/info/rfc4252">
        <front>
          <title>The Secure Shell (SSH) Authentication Protocol</title>
          <author fullname="T. Ylonen" initials="T." surname="Ylonen"/>
          <author fullname="C. Lonvick" initials="C." surname="Lonvick"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4252"/>
      </reference>
      <reference anchor="RFC4253" target="https://www.rfc-editor.org/info/rfc4253">
        <front>
          <title>The Secure Shell (SSH) Transport Layer Protocol</title>
          <author fullname="T. Ylonen" initials="T." surname="Ylonen"/>
          <author fullname="C. Lonvick" initials="C." surname="Lonvick"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4253"/>
      </reference>
      <reference anchor="RFC9519" target="https://www.rfc-editor.org/info/rfc9519">
        <front>
          <title>Update to the IANA SSH Protocol Parameters Registry Requirements</title>
          <author fullname="P. Yee" initials="P." surname="Yee"/>
          <date month="January" year="2024"/>
        </front>
        <seriesInfo name="RFC" value="9519"/>
      </reference>
      <reference anchor="RFC2104" target="https://www.rfc-editor.org/info/rfc2104">
        <front>
          <title>HMAC: Keyed-Hashing for Message Authentication</title>
          <author fullname="H. Krawczyk" initials="H." surname="Krawczyk"/>
          <author fullname="M. Bellare" initials="M." surname="Bellare"/>
          <author fullname="R. Canetti" initials="R." surname="Canetti"/>
          <date month="February" year="1997"/>
        </front>
        <seriesInfo name="RFC" value="2104"/>
      </reference>
      <reference anchor="FIPS180-4" target="https://doi.org/10.6028/NIST.FIPS.180-4">
        <front>
          <title>Secure Hash Standard (SHS)</title>
          <author><organization>National Institute of Standards and Technology</organization></author><date year="2015"/>
        </front>
        <seriesInfo name="NIST" value="FIPS 180-4"/>
      </reference>
      <reference anchor="FIPS203" target="https://doi.org/10.6028/NIST.FIPS.203">
        <front>
          <title>Module-Lattice-Based Key-Encapsulation Mechanism Standard</title>
          <author><organization>National Institute of Standards and Technology</organization></author><date year="2024"/>
        </front>
        <seriesInfo name="NIST" value="FIPS 203"/>
      </reference>
    </references>
    <references>
      <name>Informative References</name>
      <reference anchor="RFC4254" target="https://www.rfc-editor.org/info/rfc4254">
        <front>
          <title>The Secure Shell (SSH) Connection Protocol</title>
          <author fullname="T. Ylonen" initials="T." surname="Ylonen"/>
          <author fullname="C. Lonvick" initials="C." surname="Lonvick"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4254"/>
      </reference>
      <reference anchor="RFC4256" target="https://www.rfc-editor.org/info/rfc4256">
        <front>
          <title>Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)</title>
          <author fullname="F. Cusack" initials="F." surname="Cusack"/>
          <author fullname="M. Forssen" initials="M." surname="Forssen"/>
          <date month="January" year="2006"/>
        </front>
        <seriesInfo name="RFC" value="4256"/>
      </reference>
      <reference anchor="RFC8308" target="https://www.rfc-editor.org/info/rfc8308">
        <front>
          <title>Extension Negotiation in the Secure Shell (SSH) Protocol</title>
          <author fullname="D. Bider" initials="D." surname="Bider"/>
          <date month="March" year="2018"/>
        </front>
        <seriesInfo name="RFC" value="8308"/>
      </reference>
      <reference anchor="RFC9941" target="https://www.rfc-editor.org/info/rfc9941">
        <front>
          <title>Secure Shell (SSH) Key Exchange Method Using Hybrid Streamlined NTRU Prime sntrup761 and X25519 with SHA-512: sntrup761x25519-sha512</title>
          <author fullname="M. Friedl" initials="M." surname="Friedl"/>
          <author fullname="J. Mojzis" initials="J." surname="Mojzis"/>
          <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
          <date month="April" year="2026"/>
        </front>
        <seriesInfo name="RFC" value="9941"/>
      </reference>
      <reference anchor="RFC10042" target="https://www.rfc-editor.org/info/rfc10042">
        <front>
          <title>Post-Quantum/Traditional Hybrid Key Exchange with the Module-Lattice-Based Key-Encapsulation Mechanism for Use in SSH</title>
          <author fullname="P. Kampanakis" initials="P." surname="Kampanakis"/>
          <author fullname="D. Stebila" initials="D." surname="Stebila"/>
          <author fullname="T. Hansen" initials="T." surname="Hansen"/>
          <date month="August" year="2026"/>
        </front>
        <seriesInfo name="RFC" value="10042"/>
      </reference>
      <reference anchor="NIST-SP-800-227" target="https://doi.org/10.6028/NIST.SP.800-227">
        <front>
          <title>Recommendations for Key-Encapsulation Mechanisms</title>
          <author><organization>National Institute of Standards and Technology</organization></author><date year="2025"/>
        </front>
        <seriesInfo name="NIST" value="SP 800-227"/>
      </reference>
      <reference anchor="I-D.sfluhrer-ssh-mldsa" target="https://datatracker.ietf.org/doc/draft-sfluhrer-ssh-mldsa/">
        <front>
          <title>SSH Support of ML-DSA</title>
          <author fullname="S. Fluhrer" initials="S." surname="Fluhrer"/>
          <author fullname="R. Petrov" initials="R." surname="Petrov"/>
          <author fullname="R. Appel" initials="R." surname="Appel"/>
          <date month="August" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-sfluhrer-ssh-mldsa-08"/>
      </reference>
      <reference anchor="I-D.celi-wiggers-tls-authkem" target="https://datatracker.ietf.org/doc/draft-celi-wiggers-tls-authkem/">
        <front>
          <title>KEM-based Authentication for TLS 1.3</title>
          <author fullname="Thom Wiggers" initials="T." surname="Wiggers"/><author fullname="Sofia Celi" initials="S." surname="Celi"/><author fullname="Peter Schwabe" initials="P." surname="Schwabe"/><author fullname="Douglas Stebila" initials="D." surname="Stebila"/><author fullname="Nick Sullivan" initials="N." surname="Sullivan"/><date month="May" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-celi-wiggers-tls-authkem-07"/>
      </reference>
      <reference anchor="I-D.ietf-lake-authkem-edhoc" target="https://datatracker.ietf.org/doc/draft-ietf-lake-authkem-edhoc/">
        <front>
          <title>KEM-based Authentication for EDHOC</title>
          <author fullname="Lidia Pocero Fraile" initials="L." surname="Pocero Fraile"/><author fullname="Christos Koulamas" initials="C." surname="Koulamas"/><author fullname="Apostolos Fournaris" initials="A." surname="Fournaris"/><author fullname="Evangelos Haleplidis" initials="E." surname="Haleplidis"/><date month="September" year="2026"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-lake-authkem-edhoc-01"/>
      </reference>
      <reference anchor="KEMTLS" target="https://doi.org/10.1145/3372297.3423350">
        <front>
          <title>Post-Quantum TLS without Handshake Signatures</title>
          <author fullname="P. Schwabe" initials="P." surname="Schwabe"/>
          <author fullname="D. Stebila" initials="D." surname="Stebila"/>
          <author fullname="T. Wiggers" initials="T." surname="Wiggers"/>
          <date year="2020"/>
        </front>
        <refcontent>ACM CCS 2020</refcontent>
      </reference>
      <reference anchor="PQ-SSH-ACCE" target="https://doi.org/10.1109/SP61157.2025.00126">
        <front>
          <title>Post-Quantum Cryptographic Analysis of SSH</title>
          <author fullname="B. Benčina" initials="B." surname="Benčina" asciiFullname="B. Bencina" asciiInitials="B." asciiSurname="Bencina"/>
          <author fullname="B. Dowling" initials="B." surname="Dowling"/>
          <author fullname="V. Maram" initials="V." surname="Maram"/>
          <author fullname="K. Xagawa" initials="K." surname="Xagawa"/>
          <date year="2025"/>
        </front>
        <refcontent>IEEE Symposium on Security and Privacy, 2025</refcontent>
      </reference>
      <reference anchor="KEMUAuth" target="https://arxiv.org/abs/2608.24447">
        <front>
          <title>A Drop-in KEM Replacement for Client Signatures in Post-Quantum SSH</title>
          <author fullname="Hongbo Liu" initials="H." surname="Liu"/><author fullname="Yufan Su" initials="Y." surname="Su"/><author fullname="Jiangxia Ge" initials="J." surname="Ge"/><author fullname="Qionglu Zhang" initials="Q." surname="Zhang"/><author fullname="Zhaoxuan Li" initials="Z." surname="Li"/><author fullname="Xianhui Lu" initials="X." surname="Lu"/><author fullname="Li Song" initials="L." surname="Song"/><author fullname="Wenhua Gao" initials="W." surname="Gao"/><author fullname="Li Zhou" initials="L." surname="Zhou"/><date year="2026"/>
        </front>
        <refcontent>IEEE ICNP 2026 (extended manuscript available on arXiv)</refcontent>
      </reference>
    </references>
    <section anchor="appendix-a">
      <name>ML-KEM-768 Interoperability Test Vector</name>
      <t>This appendix provides one deterministic successful authentication example for the <tt>ssh-mlkem-768-hmac-sha256</tt> profile. Hexadecimal strings represent raw octets. These fixed inputs are for testing only and are not suitable for operational key generation or encapsulation.</t>
      <t>The user name is <tt>alice</tt>, the service name is <tt>ssh-connection</tt>, the authentication method is <tt>publickey-kem</tt>, and the public key format is <tt>ssh-mlkem-768</tt>. The values <tt>d</tt>, <tt>z</tt>, and <tt>m</tt> are deterministic ML-KEM inputs defined in <xref target="FIPS203"/>. The 32-octet <tt>sid</tt> is a synthetic test value rather than the result of a live SSH key exchange.</t>
      <sourcecode type="text">d=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
z=202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
m=404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f
sid=606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f</sourcecode>
      <t>The deterministic ML-KEM-768 operations and their relevant outputs are:</t>
      <sourcecode type="text">(ek, dk)  = ML-KEM.KeyGen_internal(d, z)
(K_C, ct) = ML-KEM.Encaps_internal(ek, m)
K_C=9cddd089ffe70e3996e76f7c8d06746df34d07e8657bc0fcf2bb0e1c3084aea1
ca=c5144f336c20cc54210c3156da6b19d444c36cfdbc1250a485ef04916e743505</sourcecode>
      <t>The <tt>request</tt> and <tt>challenge</tt> are the complete SSH message payloads defined in Section 4.1, beginning with the message-type bytes 50 and 60, respectively, and excluding SSH transport packet framing. The <tt>0x3d</tt> octet denotes message type 61. The label is raw ASCII with no length prefix or terminating NUL.</t>
      <sourcecode type="text">public_key_blob = SSH_string("ssh-mlkem-768") || SSH_string(ek)
ctx             = request || challenge || 0x3d
MAC_input = ASCII("ssh-publickey-kem-client-auth") ||
            SSH_string(sid) || ctx
ca              = HMAC-SHA256(K_C, MAC_input)
response        = 0x3d || SSH_string(ca)</sourcecode>
      <t>The following sizes and SHA-256 digests allow independent implementations to verify the intermediate encodings. Digests are computed over raw binary octets, not hexadecimal text.</t>
      <sourcecode type="text">ek (1184 octets), SHA-256:
  0b7934c83125c788995e2ba6bd761e33046b3e40571be53e023309a29f398cc9
ct (1088 octets), SHA-256:
  dbf4e9aa48b078ad46ec1c9c47bda8c2d2fec9d0e7a21bd48d2238a2abedb856
public_key_blob (1205 octets), SHA-256:
  1c8bab6cc89a9c0564dfa02b7c6368580443a14e5d25d9cec1dd755a5646d589
request (1283 octets), SHA-256:
  930a740e341f8a3a73933942047bbc5028a03e9ee8c61a5ce2820a22c6f64c37
challenge (2331 octets), SHA-256:
  bf7faf5ef0039b13d747828c5519f7e7806e135949cd5ac3febb07b8449969e0
ctx (3615 octets), SHA-256:
  aae32626c00541345d1fd7863f81d33b7b4f83a983cb4bd800eb005670047d05
MAC_input (3680 octets), SHA-256:
  3dc89cd08296d099c699d0e5393519032cc609c2ca5e195a8c05f84372dfe1b4
response (37 octets), SHA-256:
  eedacf149c61bd836cba35d045de603240ec22ca8e65fb5ecb6d4a6d427148c5</sourcecode>
    </section>
    <section anchor="acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>This work was supported in part by the National Cryptologic Science Fund of China under Grant 2025NCSF01008.</t>
    </section>
  </back>
</rfc>