nqprove(3)
NAME
nqprove, nqchkp
— prove some files of a capsule, and check such a
proof
LIBRARY
libnoqtis, -lnoqtis
SYNOPSIS
#include
<noqtis.h>
int
nqprove(const char *dir,
const char *const *paths, size_t
np, char *out, size_t cap,
size_t *outlen);
int
nqchkp(const char *proof,
size_t n, const nqcopt *o,
const char *dir, nqrep
**rep);
DESCRIPTION
nqprove()
writes to out, of cap bytes, a
proof (‘noqtis-proof-1,
noqtis-capsule(5)’)
that the files paths[0..np] are in the format 2
capsule in dir: the seal, the manifest's head and, per
file, its entry, its index and its Merkle audit path (RFC 9162). The proof
holds no name, size or digest of the capsule's other files. Paths are as the
manifest lists them; repeats are proven once. *outlen
gets the proof's size, also when cap is too small, so
a call with out NULL and
cap 0 gives the size to allocate.
nqprove() reads the seal and the manifest with the
checker's strict readers but does not check the capsule: call
nqchkx(3)
first.
nqchkp()
checks a proof of n bytes and returns a report as
nqchk(3) does: the
proof's form (‘proof.parse, proof.canonical,
proof.fields’), the seal and its signature over the head with
o->trust and its TSA anchors
(the other members of o are not used;
o may be NULL), and one
‘proof.entry’ row per entry whose
audit path leads to the head's Merkle root. With dir
not NULL, each proven file there is also checked
against its entry (‘file’) rows, and a
‘partial’ row says the capsule's other
files are not in the proof.
RETURN VALUES
nqprove():
NQOK- The proof was written.
- [
NQEBUF] - cap is too small; *outlen is the size needed.
- [
NQENOSUP] - The capsule is format 1.
- [
NQEIO] - A path is not in the manifest, or a file could not be read.
- [
NQEDEC] - The seal or the manifest does not parse.
- [
NQELIM] - More paths than a manifest may list.
- [
NQEARG] - A
NULLargument, or np 0. - [
NQEMEM] - The allocation hook returned
NULL.
nqchkp() returns
NQOK when every check passed and
NQEVRFY when one failed, with the report in
*rep either way; NQEARG and
NQEMEM return no report.
EXAMPLES
const char *p[1] = {"data/in.csv"};
size_t n = 0;
char *b;
if (nqprove("results", p, 1, NULL, 0, &n) == NQEBUF &&
(b = malloc(n)) != NULL &&
nqprove("results", p, 1, b, n, &n) == NQOK) {
nqcopt o = {0};
nqrep *rep = NULL;
o.trust = pk;
o.trustlen = sizeof pk;
if (nqchkp(b, n, &o, NULL, &rep) == NQOK)
puts("data/in.csv is in the capsule that key sealed");
nqrepfree(rep);
}
SEE ALSO
noqtis-check(1), noqtis-prove(1), nqchkx(3), nqrep(3), nqseal2(3), noqtis-capsule(5)
STANDARDS
Certificate Transparency Version 2.0, RFC 9162, December 2021.