Skip to content

nqseal2(3)

nqseal2, nqcapid — seal a format 2 capsule, and a capsule's id

libnoqtis, -lnoqtis

#include <noqtis.h>

typedef struct {
  uint8_t id[32];
  const char *name;
} nqcin;


int
nqseal2(const char *dir, nqsalg alg, const uint8_t *sk, size_t sklen, const uint8_t *pk, size_t pklen, const char *meta, const nqcin *in, size_t nin);

int
nqcapid(const char *dir, uint8_t id[32]);

() is nqseal(3) in format 2 (‘noqtis-capsule-2, ‘noqtis-seal-2, noqtis-capsule(5)’’): the manifest also carries a Merkle tree over its file entries, and the seal signs the manifest's head, which holds the tree's root and size but not the list of files. nqprove(3) can then show single files without the others.

in[0..nin] are the capsules this one was made from, at most 1024, recorded in the manifest's ‘inputs’: each id is an input's id from (), and each name 1 to 255 bytes of UTF-8 with no control character. in may be NULL when nin is 0. nqchkx(3) follows these records with its lin folders.

() stores in id the id of the capsule in dir: the SHA-256 of the bytes its seal signs (‘manifest_sha256 of a format 1 seal, ‘head_sha256 of a format 2 one’’), read from noqtis.sig. Nothing else is checked: check the capsule (nqchk(3)) before relying on it.

nqseal2() returns what nqseal(3) returns, and NQEARG for an input name that is empty, too long or has a control character, and NQELIM for more than 1024 inputs. nqcapid() returns NQOK, NQEIO when the seal cannot be read, NQEDEC when it is not a seal of either format, or NQEARG.

noqtis-seal(1), nqchkx(3), nqprove(3), nqseal(3), noqtis-capsule(5)