Inspect

Human-readable inspection of a parsed certificate -- the pure-JS equivalent of openssl x509 -text. certificate(input) ingests a PEM string, a DER Buffer, or an already-parsed certificate and returns a familiar OpenSSL-style report: version, serial, signature algorithm, the issuer and subject distinguished names, the validity window, the public-key details (curve or modulus size plus the raw point/modulus), every decoded extension with its critical flag, and the signature. It renders purely from the toolkit's own strict parser and two-way OID registry -- no OpenSSL dependency, and no drift-prone second naming table -- so it names extension and algorithm OIDs an OpenSSL build shows only as raw bytes. The format is stable and OpenSSL-*familiar* rather than byte-identical to any one OpenSSL version (those disagree across releases). Rendering is best-effort: a malformed extension falls back to a hex dump rather than throwing.

pki.inspect.certificate

since 0.2.4 experimental
pki.inspect.certificate(input) -> string

Render a certificate as a human-readable, OpenSSL-familiar text report. input is a PEM string, a DER Buffer, or a pki.schema.x509.parse result. A value that is none of those throws inspect/bad-input; a malformed certificate throws inspect/bad-certificate; but a malformed individual extension is rendered as a hex dump rather than failing the whole report. Pure -- no OpenSSL dependency.

Example

var cert = pki.schema.x509.parse(der);
pki.inspect.certificate(cert).split("\n")[0]; // "Certificate:"

References

pki.inspect.crl

since 0.3.8 experimental
pki.inspect.crl(input) -> string

Render a certificate revocation list as an openssl crl -text-familiar text report: issuer, Last/Next Update, the CRL extensions, each revoked entry (serial, revocation date, entry extensions), and the signature. input is a PEM string, a DER Buffer, or a pki.schema.crl.parse result; a non-CRL throws inspect/bad-crl, a wrong-type input inspect/bad-input. A malformed individual extension renders as hex rather than failing the report.

Example

pki.inspect.crl(crlDer).split("\n")[0]; // "Certificate Revocation List (CRL):"

References

pki.inspect.csr

since 0.3.8 experimental
pki.inspect.csr(input) -> string

Render a PKCS#10 certification request as an openssl req -text-familiar text report: subject, the subject public key, the requested extensions and other attributes, and the signature. input is a PEM string, a DER Buffer, or a pki.schema.csr.parse result; a non-CSR throws inspect/bad-csr, a wrong-type input inspect/bad-input. Best-effort like certificate.

Example

pki.inspect.csr(csrDer).split("\n")[0]; // "Certificate Request:"

References

pki.inspect.cms

since 0.3.8 experimental
pki.inspect.cms(input) -> string

Render a CMS message as an openssl cms -cmsout -print-familiar text report. A SignedData shows the content type, digest algorithms, encapsulated content, embedded certificates/CRLs, and each SignerInfo (signer identifier, algorithms, signed/unsigned attributes, signature); a non-SignedData ContentInfo renders a stable top-field summary. input is a PEM string, a DER Buffer, or a pki.schema.cms.parse result; a non-CMS throws inspect/bad-cms. Best-effort.

Example

pki.inspect.cms(cmsDer).split("\n")[0]; // "CMS ContentInfo:"

References

pki.inspect.any

since 0.3.8 experimental
pki.inspect.any(input) -> string

Detect which PKI format input (a PEM string or DER Buffer) encodes and render it with the matching report -- the inspect analogue of pki.schema.parse. Routes a certificate / CRL / CSR / CMS to certificate / crl / csr / cms; a detected but out-of-scope format (OCSP, TSP, PKCS#8/#12, CRMF, CMP, ...) throws inspect/unsupported-format naming it, and an unrecognized input inspect/bad-input.

Example

pki.inspect.any(der);  // routes to the right report by detected format

References