Skip to content

noqtis(3)

noqtis — post-quantum signatures, KEMs, hashes and sealed capsules in C11

libnoqtis, -lnoqtis

#include <noqtis.h>

cc prog.c $(pkg-config --cflags --libs noqtis)

find_package(noqtis CONFIG REQUIRED)        # CMake
target_link_libraries(prog PRIVATE noqtis::noqtis)

noqtis is a library in ISO C11 with no run-time dependencies. It provides the NIST post-quantum standards, byte-identical to their test vectors, and on top of them capsules: folders whose exact files are recorded, signed and checked.

nqsign(3)
ML-DSA (FIPS 204) and SLH-DSA (FIPS 205): key generation, signing (pure, with a context, and pre-hash) and verification: (), (), (), (), (), (), (), ().
nqenc(3)
ML-KEM (FIPS 203) and HQC: (), (), (), (), (), (), (), ().
nqhash(3)
SHA-2, SHA-3, SHAKE and HMAC: (), (), (), (), (), ().
nqseal(3)
Seal a folder.
nqchk(3)
Check a capsule.
nqchkt(3)
Check a capsule and its RFC 3161 timestamp.
nqtsput(3)
Timestamp a seal: (), ().
nqrep(3)
Read the check report: (), (), ().
nqrand(3)
The operating system's random source.
nqwipe(3)
Erase secrets.
nqcteq(3)
Constant-time comparison.
nqsetal(3)
The allocation hook.
nqerr(3)
Error codes and texts, ().

  • Every function that can fail returns int: NQOK (0) or a negative NQE* code (nqerr(3)). A failed verification is NQEVRFY, never NQOK.
  • Keys, signatures and ciphertexts are byte strings in the encodings the standards define. Their sizes are fixed per algorithm and available at run time from nqssize() and nqksize().
  • The caller allocates every output buffer and passes its length. A function never writes past that length, and returns NQEBUF when it is too small.
  • Secrets are wiped with () before a function returns, on every path. Operations on secret data run in constant time.
  • Randomness comes from () unless a caller passes the standard's seed or randomness through a ‘d’ variant (nqskgd(), nqsignd(), nqkkgd(), nqencd()), which exist for the test vectors.
  • The algorithm code never allocates. The capsule layer allocates through the hook of ().
  • Paths are UTF-8 on every operating system.
  • The functions are thread safe, except nqsetal(), as long as threads do not share an nqhctx, an nqrep being freed, or a capsule folder being sealed.

The library builds with CMake (‘cmake -S. -B build && cmake --build build’), static by default, -DNQSHARED=ON for shared. A shared build exports only the public functions; on Windows, programs that use the DLL define NQDLL (the CMake package and noqtis.pc do it).

include/noqtis.h
the public header
lib/libnoqtis.a, lib/libnoqtis.so.0
the library
lib/pkgconfig/noqtis.pc
the pkg-config file
lib/cmake/noqtis/
the CMake package

#include <noqtis.h>
#include <stdio.h>

int main(void) {
  printf("noqtis %s\n", nqver());
  return 0;
}

More in docs/examples of the source tree; every one is compiled and run in CI.

noqtis(1), noqtis-capsule(5)

FIPS 180-4, FIPS 198-1, FIPS 202, FIPS 203, FIPS 204, FIPS 205, SP 800-90A (HMAC_DRBG, internal), HQC version 5.0.0, RFC 3161, RFC 8785.

noqtis has not had an external security audit.