CryptoSys Home > CryptoSys PQC > Background

Background on Post-Quantum Cryptography (PQC)


The cryptographic community is planning for time when (if) a large-scale quantum computer — a Cryptographically Relevant Quantum Computer (CRQC) — will be built. If one is, then it will be able to break all current public schemes for encryption and digital signatures, such as RSA, Diffie-Hellman and ECDSA. Post-quantum cryptography (PQC) is the development of cryptographic algorithms considered to be secure against an attack by a CRQC. You will sometimes see PQC referred to as quantum-proof, quantum-safe, or quantum-resistant.

To that end, in August 2024, the National Institute of Standards and Technology (NIST) approved three algorithms currently believed to be secure against a quantum attack.
  1. ML-KEM - Module-Lattice-Based Key-Encapsulation Mechanism [FIPS.203]
  2. ML-DSA - Module-Lattice-Based Digital Signature [FIPS.204]
  3. SLH-DSA - Stateless Hash-Based Digital Signature [FIPS.205]

These are based on the original submitted algorithms Kyber, Dilithium and SPHINCS+, respectively.

The first algorithm provides public key encryption using a Key-Encapsulation Mechanism (KEM), and the last two provide digital signature schemes. These are intended to replace the algorithms RSAES, RSASSA, ECDSA and ECDH.

All these algorithms are provided in our CryptoSys PQC, a programmer's library that provides all the basic functions for the above three algorithms. It is free. See CryptoSys PQC

Note that cryptographic hash and symmetric encryption algorithms (e.g. SHA-256 and AES-128) are not threatened by advances in quantum computing.

ML-KEM — Module-Lattice-Based Key-Encapsulation Mechanism

The Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) (formerly Kyber) is a key-encapsulation mechanism (KEM) that can be used to establish a shared secret key between two parties. For an explanation of KEM see below.

ML-KEM uses lattice-based cryptography. Its security is related to the computational difficulty of solving certain systems of noisy linear equations, specifically the so-called Module Learning With Errors (MLWE) problem.

ML-KEM has three parameter sets in increasing order of security category: ML-KEM-512, ML-KEM-768 and ML-KEM-1024.

The sizes in bytes of the keys and ciphertext used in ML-KEM are shown in the following table.

Sizes in bytes
 encapsulation keydecapsulation keyciphertextshared secret keysecurity category
ML-KEM-5128001632768321
ML-KEM-768118424001088323
ML-KEM-1024156831681568325

The private decapsulation key can be represented in a much shorter "seed" form.

ML-DSA — Module-Lattice-Based Digital Signature Algorithm

The Module-Lattice-Based Digital Signature Algorithm (ML-DSA) (formerly Dilithium) is digital signature scheme. It provides algorithms for key generation, signature generation, and signature verification: see below.

ML-DSA is based on the Module Learning With Errors problem. ML-DSA has three parameter sets in increasing order of security category: ML-DSA-44, ML-DSA-65 and ML-DSA-87. The numbers 44, 65 and 87 refer to the size ($k\times \ell$) of the matrix $\mathbf{A}$ used in the calculations.

The sizes in bytes of the keys and signatures are shown in the following table.

Sizes in bytes
 private keypublic keysignature sizesecurity category
ML-DSA-442560131224202
ML-DSA-654032195233093
ML-DSA-874896259246275

The private key can be represented in a much shorter "seed" form.

Note the much larger sizes of the keys and signatures compared to classical signature algorithms. The private keys and signatures for ML-DSA are in the order of 2 to 5 kB, compared to the classical ECDSA algorithm P-256 with a private key of 32 bytes and a signature 64 bytes long.

SLH-DSA — Stateless Hash-Based Digital Signature Algorithm

The Stateless Hash-Based Digital Signature Algorithm (SLH-DSA) is a digital signature scheme based on SPHINCS+. It provides algorithms for key generation, signature generation, and signature verification: see below.

The security of SLH-DSA relies on the security properties of hash functions, in particular the difficulty of finding preimages for hash functions (preimage resistance).

SLH-DSA is a stateless hash-based signature scheme, which avoids the problems of stateful hash-based schemes (like LMS and XMSS). Stateful hash-based schemes require the signer to maintain a state index to prevent the use of any previously-used private keys: re-using a key can destroy the security of the scheme. SLH-DSA does not have this limitation and is designed to sign up to $2^{64}$ messages with one key, effectively an unlimited number.

There are 12 parameter sets for SLH-DSA. These are made up of three security categories 128/192/256 corresponding to security parameters $n = 16, 24, 32$. Six of these parameter sets use the SHA2 hash functions from [FIPS.180-4] (specifically SHA-256 and SHA-512) and the other six use SHAKE from [FIPS.202]. There are slow "s" and fast "f" variants which trade off speed against size when generating signatures.

The sizes in bytes of the keys and signatures are shown in the following table.

Sizes in bytes
 nprivate keypublic keysignature sizesecurity category
SLH-DSA-SHA2-128s
SLH-DSA-SHAKE-128s
1664327 8561
SLH-DSA-SHA2-128f
SLH-DSA-SHAKE-128f
16643217 0881
SLH-DSA-SHA2-192s
SLH-DSA-SHAKE-192s
24964816 2243
SLH-DSA-SHA2-192f
SLH-DSA-SHAKE-192f
24964835 6643
SLH-DSA-SHA2-256s
SLH-DSA-SHAKE-256s
321286429 7925
SLH-DSA-SHA2-256f
SLH-DSA-SHAKE-256f
321286448 8565

Note the huge signature sizes for SLH-DSA, up to 48 kB!

Seed key forms for ML-DSA and ML-KEM

The private keys for ML-DSA and ML-KEM can be stored in a much shorter "seed" form: 32 bytes for ML-DSA and 64 bytes for ML-KEM. This seed is used in the $\textsf{KeyGen}$ algorithm to generate a key pair in a deterministic manner. The longer private keys generated using KeyGen are known as the "expanded" key. This seed form is a more convenient way to store and distribute the private keys.

Detailed explanation of schemes

Digital Signature Scheme

The two digital signature schemes, ML-DSA and SLH-DSA, each provide three functions: $\textsf{KeyGen}$, $\textsf{Sign}$ and $\textsf{Verify}$.
  1. $(pk, sk) \leftarrow \textsf{KeyGen}()$

    Generate a public key $pk$ and a private key $sk$ using fresh randomness each time. The signing party keeps the private key secret and publishes the public key.

  2. $\sigma \leftarrow \textsf{Sign}(sk, M)$

    The signer signs the message $M$ using the private key $sk$ to produce the signature $\sigma$. $\textsf{Sign}$ can either be used in the "hedged" variant with fresh randomness each time or in a deterministic manner.

  3. $\{\texttt{valid|invalid}\} \leftarrow \textsf{Verify}(pk, \sigma, M)$

    Anyone in possession of the public key $pk$ can verify the signature $\sigma$ over the original message $M$.

In addition, the Sign function can specify an optional context string to provide additional customisation. The same context string must be known by the verifier and be used in the Verify function.

Both the PQC digital signature schemes have a "pure" variant as described above, generating the signature over the original message $M$, and a "pre-hash" version where the input to the $\textsf{Sign}$ function is a message digest of the original message $H(M)$ using a hash function $H$. In the pre-hash variant, the hash function $H$ must be specified in the input and its identity is incorporated in the signature.

ML-DSA also has a ExternalMu variant, where the value of $\mu$ ("mu") is pre-computed and passed as input instead of the message and context. This is suitable for long messages and has the advantage that the signature is mathematically equivalent to the "pure" variant. It requires the value of the public key $pk$. In simplified form, the value of $\mu$ is computed as follows, where M is the message to be signed, ctx is the context string which may be empty, 0xNN is a one-byte representation of the length of the context string [0-255] and $H()$ is the SHAKE256 function with a fixed output of 64 bytes.

mu = H( H(pk) || 0x01 || 0xNN || ctx || M )

Key Encapsulation Mechanism (KEM)

ML-KEM uses a Key Encapsulation Mechanism (KEM) to establish a shared secret key between two parties - the originator and the recipient. The shared secret key $ss$ may also be denoted as $K$. In ML-KEM the shared secret key value $ss$ is always 32 bytes long. This shared secret key can be used by both parties to encrypt and decrypt confidential data using classic symmetric encryption algorithms such as AES. Classic symmetrical encryption algorithms like AES are not believed to be vulnerable to quantum computers.

KEM provides three functions: $\textsf{KeyGen}$, $\textsf{Encaps}$ and $\textsf{Decaps}$.

  1. $(ek, dk) \leftarrow \textsf{KeyGen}()$

    The recipient generates an encapsulation key $ek$ ("public key") and a decapsulation key $dk$ ("private key"). The recipient keeps the decapsulation key secret and provides the encapsulation key to the originator.

  2. $(ct, ss) \leftarrow \textsf{Encaps}(ek)$

    The originator employs the encapsulation algorithm with the recipient's public encapsulation key $ek$ to generate the shared secret key $ss$ and an associated ciphertext $ct$. The ciphertext $ct$ is passed to the recipient. Some authors, e.g. NIST, use the notation $(c, K)$ instead of $(ct, ss)$.

  3. $ss \leftarrow \textsf{Decaps}(dk, ct)$

    The recipient uses their private decapsulation key $dk$ and the ciphertext $ct$ in the decapsulation algorithm to compute the shared secret key $ss$.

After the interchange of $ek$ and $ct$, both parties are now in possession of the same shared secret key $ss$, which can be used with conventional symmetric encryption to pass encrypted messages between the parties. For ML-KEM, $ss$ is always 512 bits (64 bytes) long.

For added security or to derive a key of a different length, L, a Key Derivation Function (KDF) — for example, HKDF — can be used on $ss$, perhaps with some optional sharedInfo, ss' = KDF(ss, sharedInfo, L)

Once the shared secret key is established between the two parties, either party can encrypt some confidential data $M$ using a conventional symmetric encryption algorithm with the shared secret key, $C = \textsf{Encrypt}(ss, M)$ and send $C$ over an open channel to the other party, who can decrypt $M = \textsf{Decrypt}(ss, C)$.

Here is a protocol diagram showing the use of KEM

Recipient Originator 

$(ek, dk) \leftarrow \textsf{KeyGen}()$
  (perform key generation)
 $\overset{ek}{\longrightarrow}$ 
 $(ct, ss) \leftarrow \textsf{Encaps}(ek)$(perform encapsulation)
 $\overset{ct}{\longleftarrow}$ 
$ss \leftarrow \textsf{Decaps}(dk, ct)$  (perform decapsulation)
 
(exchange messages using symmetric encryption)
  $C \leftarrow \textsf{Encrypt}(ss, M)$(encrypt message using $ss$)
 $\overset{C}{\longleftarrow}$ 
$M \leftarrow \textsf{Decrypt}(ss, C)$  (decrypt message)
 
$C_1 \leftarrow \textsf{Encrypt}(ss, M_1)$  (pass message in opposite direction)
 $\overset{C_1}{\longrightarrow}$ 
  $M_1 \leftarrow \textsf{Decrypt}(ss, C_1)$(repeat at will)

NIST security categories

For the PQC schemes, rather than specifying security levels as 128/192/256 "bits of security", NIST has specified five security categories based on the range of existing security strengths in symmetric cryptography. These are, in order of increasing strength:

Any attack that breaks the relevant security definition must require computational resources comparable to or greater than those required for ...
  1. a key search on a block cipher with a 128-bit key (e.g. AES128)
  2. a collision search on a 256-bit hash function (e.g. SHA256/SHA3-256)
  3. a key search on a block cipher with a 192-bit key (e.g. AES192)
  4. a collision search on a 384-bit hash function (e.g. SHA384/SHA3-384)
  5. a key search on a blockcipher with a 256-bit key (e.g. AES256)

For example, NIST assumes that a brute-force collision attack on SHA256 will be technologically feasible before a brute-force key search attack on AES192.

Some Background Theory

See our papers with some background and theory on the algorithms used in the NIST PQC schemes.

SPHINCS+ A stateless hash-based signature scheme (SLH-DSA)
In this series of pages on SPHINCS+ (SLH-DSA), we take an in-depth look at the calculations required to compute a specific SPHINCS+ signature and present some background basics.
A simple lattice-based encryption scheme
This page looks at a simple lattice-based public-key encryption scheme that shows the connection between scheme security and lattice problems. It is a fundamental building block in several lattice-based homomorphic encryption schemes, including ML-KEM/Kyber.

References

Contact us

To contact us, please send us a message. To comment on this page, see comments below.

[Go to top]

This page last updated 8 July 2025

Comments

   [Go to last comment] [Our comments policy]
[Go to first comment]