Compute fingerprint (DER digest, key identifier, SHAKE256)
compute_fingerprintComputes SHA fingerprint, RFC 5280 key identifier, or SHAKE256 digest for a certificate, CSR, public key, or DER/PEM object, with configurable algorithm and hex formatting.
Instructions
Read-only digest of ONE object. mode:'fingerprint' (default) hashes the exact DER of the input (SHA-256 by default; SHA-1 / SHA-384 / SHA-512; webcrypto:true uses Web Crypto, same result) — what openssl x509 -fingerprint prints; mode:'key-id' computes the RFC 5280 §4.2.1.2 key identifier (SHA-1 by default, or SHA-256) of the public key found in a certificate, a CSR or a PUBLIC KEY, reporting where it came from; mode:'shake256' squeezes outputLength bytes (default 32, ≤ 1048576) of SHAKE256 — the digest of an Ed448 CMS signer. hex is lowercase without separators, formatted follows separator (':' default) and letterCase (upper default). Any PEM label or DER is accepted (a private key may be digested: the digest reveals nothing and no input byte is returned); a bundle of several blocks is refused (extract one with convert_pem). Refuses: an algorithm outside its mode, SHA-384/512 for a key identifier, outputLength or webcrypto outside their mode (VALIDATION_ERROR); key-id on an object that holds no public key (PKI_X509_* / PKI_ASN1_*). Token-frugal: verbosity:'summary', fields:[…].
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'fingerprint' (default): the digest of the exact DER. 'key-id': the RFC 5280 §4.2.1.2 identifier of the public key of a certificate, a CSR or a PUBLIC KEY. 'shake256': SHAKE256 output of `outputLength` bytes. | fingerprint |
| input | Yes | The object to digest (any PEM label, or DER): exactly one of pem / derBase64 / path. A bundle of several blocks is refused: extract one with convert_pem. | |
| fields | No | Dot-paths to keep after verbosity (arrays map over elements); unmatched paths land in _meta.unmatchedFields. | |
| limits | No | Raise pkinative's 22 named security bounds for this call (trusted input only; absent keys keep the engine defaults). A value above an operator ceiling (PKINATIVE_MCP_MAX_INPUT_BYTES, PKINATIVE_MCP_MAX_KDF_ITERATIONS, PKINATIVE_MCP_MAX_PATHS_EXPLORED) is LIMIT_CEILING_EXCEEDED; describe_engine lists the defaults and the ceilings. | |
| strict | No | Escalate the first engine warning to a PKI_STRICT_DIAGNOSTIC error instead of listing it in diagnostics[]. | |
| pemMode | No | 'strict' (RFC 7468 exactly, default) or 'lax' (tolerates whitespace, line length and RFC 1421 headers). | strict |
| algorithm | No | fingerprint: SHA-1 | SHA-256 (default) | SHA-384 | SHA-512. key-id: SHA-1 (default, RFC 5280 method 1) | SHA-256. Not for shake256. | |
| separator | No | Placed between octets of `formatted` (default ':'; '' for none). | : |
| verbosity | No | 'summary' keeps the scalar fields only (token-frugal). | full |
| webcrypto | No | fingerprint only: digest through Web Crypto instead of the pure-TypeScript hashes (identical result). | |
| letterCase | No | Hex case of `formatted` (`hex` is always lowercase). | upper |
| outputLength | No | shake256 only: output bytes (default 32, ≤ 1048576; 64 for an Ed448 CMS signer). | |
| encodingRules | No | 'der' (strict X.690 DER, default) or 'ber' (indefinite / non-minimal lengths and constructed strings, as legacy CMS producers write). | der |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex | No | The digest as lowercase hex, no separator. | |
| from | No | key-id: where the public key came from. | |
| mode | No | ||
| label | No | The PEM label of the input, null for DER. | |
| algorithm | No | SHA-1 | SHA-256 | SHA-384 | SHA-512, or 'SHAKE256'. | |
| formatted | No | The digest with the separator and case asked for (AB:CD:… by default). | |
| sizeBytes | No | Bytes digested: the DER of the input (fingerprint, shake256) or the public key bits (key-id). | |
| diagnostics | No | Non-fatal concerns the engine raised (PKI_DIAG_*, de-duplicated, at most 200; explain_code explains one). | |
| outputLength | No | shake256: the output length in bytes. | |
| diagnosticCount | No | ||
| diagnosticCounts | No | Occurrences per diagnostic code. | |
| diagnosticsTruncated | No | true when distinct diagnostics beyond the 200 listed were dropped. |