Encode, decode, and validate ASN.1 data in browsers and Node.js. asn1js ships TypeScript types and is the foundation of PKIjs, so it handles the structures behind X.509 certificates, PKCS, CMS, and LDAP.
Decode bytes into a tree of ASN.1 objects with fromBER() and encode them back with toBER(). Every tag, length, and value block stays accessible, byte by byte.
Supports the universal types of ASN.1:2008. Integers convert to bigint, object identifiers to dotted strings, string types to string, and time types to Date.
Describe the structure you expect, then validate and extract fields by name in one step. Optional fields, Any, Choice, and Repeated cover real-world modules.
Universal, application, context-specific, and private tags, with explicit and implicit tagging, and constructed or primitive encoding.
Limits on nesting depth, node count, and content length stop malicious input before it exhausts memory or the call stack.
Checked against the freely available ASN.1:2008 test suite, and used in production through PKIjs.