Node-OPCUA Crypto is a robust, TypeScript-first JavaScript module designed to provide a comprehensive suite of cryptographic functionalities specifically for the OPC UA standard. It seamlessly operates in both Node.js and browser environments, ensuring broad compatibility for various industrial IoT and M2M applications. The library is currently on its stable version 5.3.5, with recent releases, such as v5.2.0, focusing on critical improvements like dependency reduction, enhanced browser compatibility, and the introduction of new cryptographic utilities including CRL-to-issuer matching. Key differentiators include its deep integration with OPC UA security requirements, support for generating private keys and X.509 self-signed certificates using native WebCrypto APIs, and dual CommonJS/ESM module support since version 3.0.0. This makes it a foundational component for securing OPC UA communications, offering tools for certificate management, key generation, and compliance with modern cryptographic practices. The project maintains an active release cadence, addressing bugs and introducing features regularly.
npm install node-opcua-cryptoVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to generate a private key and then use it to create a self-signed X.509 certificate, common for OPC UA server and client identities.
Upgrade Node.js to version 22 or newer, or pin `node-opcua-crypto` to a v4.x release.
For Node.js apps, use `import * as crypto from 'node-opcua-crypto';`. For browser environments (or Node.js apps that don't need file system APIs), use `import * as crypto from 'node-opcua-crypto/web';`.
Ensure your project's `tsconfig.json` or build tools are configured to correctly handle ESM imports (`"type": "module"` in `package.json` for Node.js projects, or specific bundler configurations for browsers). Prefer `import` statements over `require()` where possible.
Upgrade to version 4.5.0 or newer to resolve the `AuthorityKeyIdentifier` regression.
Upgrade to version 4.7.0 or newer to patch known vulnerabilities related to `jsrsasign`.
Upgrade `node-opcua-crypto` to version 4.5.0 or higher to correctly include the AuthorityKeyIdentifier.
Ensure correct API usage, or upgrade to `node-opcua-crypto` v4.2.0 or newer if the issue is related to how certificates are created internally by the library.
Update `node-opcua-crypto` to version 4.10.0 or later to ensure proper parsing of certificates with 'othernames' in SubjectAltName.
For projects running Node.js with ESM enabled, use `import` statements. If a CJS-only context is required, ensure the package version is compatible or use dynamic `import()` if necessary. Consider configuring `package.json` with `"type": "module"` and using `import`.
No dependency data recorded yet.