Postquantum public key algorithms for the Secure Shell (SSH) protocol
Cisco Systems
pkampana@cisco.com
University of Waterloo
dstebila@uwaterloo.ca
OpenSSH
markus@openbsd.org
AWS
htorben@amazon.com
University of New Mexico
dsike@unm.edu
Security
CURDLE
postquantum SSH
This document defines hybrid key exchange methods based on classical ECDH key exchange and postquantum key encapsulation schemes. These methods are defined for use in the SSH Transport Layer Protocol. It also defines postquantum public key authentication methods based on postquantum signature schemes. These methods are defined for use in the SSH Authentication Protocol.
EDNOTE: The goal of this draft is to start the standardization of PQ algorithms in SSH early to mitigate the potential recordandharvest later with a quantum computer attacks. This draft is not expected to be finalized before the NIST PQ Project has standardized PQ algorithms. After NIST has standardized then this document will replace TBD1, TBD3 with the appropriate algorithms and parameters before proceeding to ratification.
EDNOTE: Discussion of this work is encouraged to happen on the IETF WG Mailing List or in the GitHub repository which contains the draft: https://github.com/csostopk/pqssh/issues .
Change Log
[EDNOTE: Remove befor publicaton].
 draftkampanakiscurdlepqssh00

Introduction
Secure Shell (SSH) RFC4251 performs key establishment using key exchange methods based exclusively on (Elliptic Curve) DiffieHellman style schemes. SSH RFC4252, RFC8332, RFC5656, RFC8709 also defines public key authentication methods based on RSA or ECDSA/EdDSA signature schemes. The cryptographic security of these key exchange and signature schemes relies on certain instances of the discrete logarithm and integer factorization problems being computationally infeasable to solve for adversaries.
However, when sufficiently large quantum computers become available these instances would no longer be computationally infeasable rendering the current key exchange and authentication methods in SSH insecure . While large quantum computers are not available today an adversary can record the encrypted communication sent between the client and server in an SSH session and then later decrypt the communication when sufficiently large quantum computers become available. This kind of attack is known as a "recordandharvest" attack. Recordandharvest attacks do not apply retroactively to authentication but a quantum computer could threaten SSH authentication by impersonating as a legitimate client or server.
This document proposes to address the problem by extending the SSH Transport Layer Protocol RFC4253 with hybrid key exchange methods and the SSH Authentication Protocol RFC4252 with public key methods based on postquantum signature schemes. A hybrid key exchange method maintains the same level of security provided by current key exchange methods, but also adds quantum resistance. The security provided by the individual key exchange scheme in a hybrid key exchange method is independent. This means that the hybrid key exchange method will always be at least as secure as the most secure key exchange scheme executed as part of the hybrid key exchange method.
In the context of the NIST PostQuantum Cryptography Standardization Project, key exchange algorithms are formulated as key encapsulation mechanisms (KEMs), which consist of three algorithms:
 'KeyGen() > (pk, sk)': A probabilistic key generation algorithm, which generates a public key 'pk' and a secret key 'sk'.
 'Encaps(pk) > (ct, ss)': A probabilistic encapsulation algorithm, which takes as input a public key 'pk' and outputs a ciphertext 'ct' and shared secret 'ss'.
 'Decaps(sk, ct) > ss': A decapsulation algorithm, which takes as input a secret key 'sk' and ciphertext 'ct' and outputs a shared secret 'ss', or in some cases a distinguished error value.
The main security property for KEMs is indistinguishability under adaptive chosen ciphertext attack (INDCCA2), which means that shared secret values should be indistinguishable from random strings even given the ability to have arbitrary ciphertexts decapsulated. INDCCA2 corresponds to security against an active attacker, and the public key / secret key pair can be treated as a longterm key or reused. A weaker security notion is indistinguishability under chosen plaintext attack (INDCPA), which means that the shared secret values should be indistinguishable from random strings given a copy of the public key. INDCPA roughly corresponds to security against a passive attacker, and sometimes corresponds to onetime key exchange.
The corresponding postquantum signature algorithms defined in the NIST PostQuantum Cryptography Standardization Project are
 'KeyGen() > (pk, sk)': A probabilistic key generation algorithm, which generates a public key 'pk' and a secret key 'sk'.
 'Sign(m, sk) > sig': A deterministic signing algorithm, which takes as input a message 'm' and a private key 'sk' and outputs a signature 'sig'.
 'Verify(m, pk, sigma) > pass/fail': A verification algorithm, which takes as input a message 'm', a public key 'pk' and a signature 'sig' and outputs a verification pass or failure of the signature on the message.
The postquantum KEMs used for hybrid key exchange in the document are TBD1. The postquantum signature algorithm used for key based authentication is TBD3. [EDNOTE: Placeholder. Algorithms will be identified after NIST Round 3 concludes.] The postquantum algorithms are defined in NIST Postquantum Project. [EDNOTE: Update link. Algorithms can change based on NIST's Round 3 standardization].
Requirements Language
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119.
Hybrid Key Exchange
Hybrid Key Exchange Method Abstraction
This section defines the abstract structure of a hybrid key exchange method. The structure must be instantiated with two key exchange schemes. The byte, string and mpint are to be interpreted in this document as described in RFC4251.
The client sends
where C_INIT would be the concatenation of C_PQ and C_CL.
The server sends
where S_REPLY would be the concatenation of S_PQ and S_CL.
[EDNOTE: Initially we were using S_CL, S_PQ, C_CL, C_PQ which were encoding the server and client client and server classical and postquantum public key/ciphertext as its own string. We since switched to an encoding method which concatenates them together as a single string in the C_INIT, S_REPLY message. This method concatenates the raw values rather than the length of each value plus the value. The total length of the concatenation is still known, but the relative lengths of the individual values that were concatenated is no longer part of the representation. If that is the WG consensus we need to put a note of this in the Appendix for historical reference and expand on the concatenated string here in this section.]
C_PQ represents the 'pk' output of the corresponding KEMs' 'KeyGen' at the client. S_PQ represents the ciphertext 'ct' output of the corresponding KEMs' 'Encaps' algorithm generated by the server to the client's public key. The client decapsulates the ciphertext by using its private key which leads to K_PQ, a postquantum shared secret for SSH.
C_CL and S_CL represent the ephemeral public key of the client and server respectively used for the classical (EC)DH key exchange which leads to K_CL, a classical shared secret for SSH.
Key Derivation
The shared secrets K_CL and K_PQ are the output from the two key exchange schemes X and Y, respectively, that instantiates an abstract hybrid key exchange method . The SSH shared secret K is derived as the hash algorithm specified in the named hybrid key exchange method name over the concatenation of K_PQ and K_CL:
The resulting bytes are fed as to the key exchange method's hash function to generate encryption keys.
FIPScompliance of shared secret concatenation.
or give NIST recommendations for key derivation methods in key exchange protocols. Some hybrid combinations may combine the shared secret from a NISTapproved algorithm (e.g., ECDH using the nistp256/secp256r1 curve) with a shared secret from a nonapproved algorithm (e.g., postquantum). lists simple concatenation as an approved method for generation of a hybrid shared secret in which one of the constituent shared secret is from an approved method.
HASH
The derivation of encryption keys MUST be done according to Section 7.2 in RFC4253 with a modification on the exchange hash H. The hybrid key exchange hash H is the result of computing the HASH, where HASH is the hash algorithm specified in the named hybrid key exchange method name, over the concatenation of the following
The HASH functions used for the definitions in this specification are SHA256 [EDNOTE: Update here if necessary].
Hybrid Key Exchange Method Names
The hybrid key exchange method names defined in this document are
[EDNOTE: Placeholder. Algorithms will be identified after NIST Round 3 concludes.]
ecdhnistp256TBD1sha256
ecdhnistp256TBD1sha256 defines that the classical C_CL or S_CL from the client or server NIST P256 curve public key as defined in . Private and public keys are generated as described therein. Public keys are defined as strings of 32 bytes for NIST P256. The K_CL shared secret is generated from the exchanged C_CL and S_CL public keys as defined in (key agreement method ecdhsha2nistp256) with SHA256 .
The postquantum C_PQ or S_PQ string from the client and server are TBD1. The K_PQ shared secret is decapsulated from the ciphertext S_PQ using the client private key [EDNOTE: Placeholder. Update based on the algorithm identified after NIST Round 3 concludes.]
x25519TBD1sha256
x25519TBD1sha256 defines that the classical C_CL or S_CL from the client or server is Curve25519 public key as defined in . Private and public keys are generated as described therein. Public keys are defined as strings of 32 bytes for Curve25519. The K_CL shared secret is generated from the exchanged C_CL and S_CL public keys as defined in (key agreement method curve25519sha256) with SHA256 .
The postquantum C_PQ or S_PQ string from the client and server are TBD1. The K_PQ shared secret is decapsulated from the ciphertext S_PQ using the client private key as defined in [EDNOTE: Placeholder. Update based on the algorithm identified after NIST Round 3 concludes.]
Key Authentication
[EDNOTE: Discuss if hybrid auth keys which combine classical and PQ signatures are necessary. Since authentication cannot be broken retroactively, even if the PQ signature algorithms got broken, we could switch to a classical algorithm to at least keep the classical security. On the other hand, that would take time to deploy while these entities would be vulnerabile to impersonation attacks. Hybrid signatures add some overhead, but could provide the peace of mind of remaining secure with the classical algorithm without scrambling to deploy a change even if the PQ algorithms got broken. ]
Public Key Format
Here, 'key' is the xoctet public key described in the TBD3 specification.
[EDNOTE: Placeholder. Algorithms will be identified after NIST Round 3 concludes.]
Signature Format
Here, 'signature' is the xoctet signature produced in accordance with the TBD3 specification.
[EDNOTE: Placeholder. Algorithms will be identified after NIST Round 3 concludes.]
Signing and Verification
Signatures are generated according to the procedure in TBD3 specification
Signatures are verified according to the procedure in TBD3 specification
[EDNOTE: Placeholder. Algorithms will be identified after NIST Round 3 concludes.]
Message Size
An implementation adhering to RFC4253 must be able to support packets with an uncompressed payload length of 32768 bytes or less and a total packet size of 35000 bytes or less (including
'packet_length', 'padding_length', 'payload', 'random padding', and 'mac'). These numbers represent what must be 'minimally supported' by implementations. This can present a problem when using postquantum key exchange schemes because some postquantum schemes can produce much larger messages than what is normally produced by existing key exchange methods defined for SSH. This document does not define any named domain parameters (see Section 7) that cause any hybrid key exchange method related packets to exceed the minimally supported packet length. This document does not define behaviour in cases where a hybrid key exchange message cause a packet to exceed the minimally supported packet length.
IANA Considerations
This memo includes requests of IANA for
SSH_MSG_HBR_INIT, SSH_MSG_HBR_REPLY, ecdhnistp256TBD1sha256, x25519TBD1sha256, and sshTBD3.
Security Considerations
[EDNOTE: The security considerations given in [RFC5656] therefore also applies to the ECDH key exchange scheme defined in this document. Similarly for the X25519 document. PQ Algorithms are newer and standardized by NIST. And more. Should include something about the combination method for the KEM shared secrets. ]
[EDNOTE: Discussion on whether an INDCCA KEM is required or whether INDCPA suffices.] Any KEM used in the manner described in this document MUST explicitly be designed to be secure in the event that the public key is reused, such as achieving INDCCA2 security or having a transform like the FujisakiOkamoto transform applied. While it is recommended that implementations avoid reuse of KEM public keys, implementations that do reuse KEM public keys MUST ensure that the number of reuses of a KEM public key abides by any bounds in the specification of the KEM or subsequent security analyses. Implementations MUST NOT reuse randomness in the generation of KEM ciphertexts.
Public keys, ciphertexts, and secrets should be constant length. This document assumes that the length of each public key, ciphertext, and shared secret is fixed once the algorithm is fixed. This is the case for all Round 3 finalists and alternate candidates.
Note that variablelength secrets are, generally speaking, dangerous. In particular, when using key material of variable length and processing it using hash functions, a timing side channel may arise. In broad terms, when the secret is longer, the hash function may need to process more blocks internally. In some unfortunate circumstances, this has led to timing attacks, e.g. the Lucky Thirteen and Raccoon attacks.
Therefore, this specification MUST only be used with algorithms which have fixedlength shared secrets (after the variant has been fixed by the algorithm identifier in the Method Names negotiation in ).
References
Normative References
Informative References
PostQuantum Cryptography
NIST
SP 800186
NIST
FIPS PUB 1804
NIST
A Modular Analysis of the FujisakiOkamoto Transformation
Secure Integration of Asymmetric and Symmetric Encryption Schemes
Recommendation for KeyDerivation Methods in KeyEstablishment Schemes
National Institute of Standards and Technology (NIST)
Recommendation for Existing ApplicationSpecific Key Derivation Functions
National Institute of Standards and Technology (NIST)
Raccoon Attack: Finding and Exploiting MostSignificantBitOracles in TLSDH(E)
Lucky Thirteen: Breaking the TLS and DTLS record protocols