PKI.js implements common public-key infrastructure formats and workflows in JavaScript. Cryptography is delegated to the Web Crypto API with no browser plugins.
Overview
PKI.js is a TypeScript library for building applications that use X.509 certificates and related standards. It covers the data structures and protocols typically found in signing, encryption, enrollment, and validation flows.
You can create, parse, sign, and verify X.509 certificates and PKCS#10 certificate requests. Chain validation can check revocation using certificate revocation lists and OCSP. The library also handles Cryptographic Message Syntax for signing and encryption, including S/MIME-style use cases and signed PDF verification described in its examples.
Time-stamp protocol requests and responses let you prove data existed before a given time. PKCS#12 and PKCS#8 support covers password- or certificate-protected key containers. PKI objects are built on asn1js, and the design intentionally avoids shipping its own cryptographic primitives.
The project targets native web applications and Node.js environments that already expose Web Crypto. Documentation and examples walk through certificates, CRLs, OCSP, CMS, timestamps, and PKCS#12 handling.
Key features
- X.509 certificate create, parse, sign, and verify
- PKCS#10 certificate request handling
- Certificate chain validation with CRL and OCSP
- CMS signing and encryption
- RFC 3161 timestamp requests and responses
- PKCS#12 and PKCS#8 key containers
- Web Crypto API for all cryptography
- TypeScript-oriented PKI object model
Use cases
- Browser-based certificate tooling without plugins
- S/MIME message signing and verification
- OCSP and CRL processing in custom apps
- CMS encryption and signature workflows