noqtis(3)
NAME
noqtis —
post-quantum signatures, KEMs, hashes and sealed capsules
in C11
LIBRARY
libnoqtis, -lnoqtis
SYNOPSIS
#include
<noqtis.h>
cc prog.c $(pkg-config --cflags --libs noqtis) find_package(noqtis CONFIG REQUIRED) # CMake target_link_libraries(prog PRIVATE noqtis::noqtis)
DESCRIPTION
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:
nqskg(),nqskgd(),nqsign(),nqsignd(),nqvrfy(),nqssize(),nqsname(),nqsfind(). - nqenc(3)
- ML-KEM (FIPS 203) and HQC:
nqkkg(),nqkkgd(),nqenc(),nqencd(),nqdec(),nqksize(),nqkname(),nqkfind(). - nqhash(3)
- SHA-2, SHA-3, SHAKE and HMAC:
nqhash(),nqhini(),nqhupd(),nqhfin(),nqhlen(),nqhmac(). - 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:
nqtsreq(),nqtsput(). - nqrep(3)
- Read the check report:
nqrepn(),nqrepi(),nqrepfree(). - 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,
nqver().
Conventions
- Every function that can fail returns int:
NQOK(0) or a negativeNQE*code (nqerr(3)). A failed verification isNQEVRFY, neverNQOK. - 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() andnqksize(). - The caller allocates every output buffer and passes its length. A function
never writes past that length, and returns
NQEBUFwhen it is too small. - Secrets are wiped with
nqwipe() before a function returns, on every path. Operations on secret data run in constant time. - Randomness comes from
nqrand() 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
nqsetal(). - 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.
Building
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).
FILES
- 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
EXAMPLES
#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.
SEE ALSO
STANDARDS
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.
CAVEATS
noqtis has not had an external security audit.