Stateful hash-based
pki.shbs.verify
pki.shbs.verify(publicKey, message, signature) -> boolean
Verify an HSS (Hierarchical Signature System) signature over message under publicKey -- the wire form RFC 9802 (X.509) and RFC 9708 (CMS) carry for id-alg-hss-lms-hashsig. The public key and signature are the raw HSS octet blobs the certificate / CMS parsers already surface (no ASN.1 wrapping). Every level of the hierarchy must verify: a single failing level yields false. Returns true for a valid signature, false for a well-formed signature that does not verify; a malformed blob (bad length, unknown or unapproved typecode, truncation, a typecode disagreeing between the key and the signature) throws a typed ShbsError. VERIFY ONLY -- this module never signs.
Example
var cert = pki.schema.x509.parse(der);
var ok = pki.shbs.verify(cert.subjectPublicKeyInfo.publicKey.bytes,
cert.tbsBytes, cert.signatureValue.bytes);
References
- spec RFC 8554 sec. 6
- spec RFC 9802
- spec RFC 9708
pki.shbs.verifyLms
pki.shbs.verifyLms(publicKey, message, signature) -> boolean
Verify a single-tree LMS (Leighton-Micali Signature) over message -- the component an HSS hierarchy composes at each level, and a standalone algorithm in its own right. Same verdict contract as pki.shbs.verify: true / false for a well-formed signature, a typed ShbsError for a malformed blob.
Example
// lmsPublicKey / lmsSignature are raw LMS blobs (an HSS level, or a bare
// LMS-signed artifact). Shown here on arbitrary bytes, which fail closed.
var ok = pki.shbs.verifyLms(bytes, bytes, bytes);
References
- spec RFC 8554 sec. 5