Node Forge is a comprehensive JavaScript library providing native implementations of cryptographic tools, network transports (like TLS, HTTP, SSH), and PKI components. It supports a wide array of ciphers (AES, DES), message digests (SHA-1, SHA-256, MD5), and PKI standards (X.509, PKCS# series). The current stable version is 1.4.0, which continues to build on its CommonJS module structure for Node.js and UMD bundles for browser environments. Its key differentiators include its entirely JavaScript-native implementation, which avoids native dependencies, and its extensive feature set for both client-side and server-side cryptographic operations, from generating RSA key pairs to parsing X.509 certificates.
npm install node-forgeVerified import paths — ran on the pinned version, not inferred.
Generates an RSA key pair, exports public and private keys in PEM format, and then creates a self-signed X.509 certificate using these keys.
Upgrade to `node-forge@^1.0.0` and update `require`/`import` statements to access modules via the main `forge` object. Review the 1.x API documentation for specific changes.
Read the 'Security Considerations' in the official documentation. Use strong, cryptographically secure random number generators (CSPRNGs) provided by the library. Consult security experts for sensitive applications.
Always use `import forge from 'node-forge';` for ESM, and then access sub-modules (e.g., `forge.pki`, `forge.util`) as properties of the `forge` object. For CommonJS, use `const forge = require('node-forge');`.Be aware of the global `forge` object in browser environments. If integrating into a larger application, consider wrapping the script or using a module loader if possible to isolate the scope, or rename the global variable if the build process allows.
Ensure `forge` is correctly imported as a default export (`import forge from 'node-forge';`) or required (`const forge = require('node-forge');`). Submodules are then accessed via `forge.pki`.For browsers, use the UMD bundles via a `<script>` tag (e.g., `<script src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js"></script>`). For ESM Node.js, use `import forge from 'node-forge';`.
Ensure you are calling `.create()` on the *algorithm factory* itself, e.g., `forge.md.sha256.create()`. Also verify the algorithm name is correct and supported.
No dependency data recorded yet.