RSA Key Generator
Generates RSA public/private keypair (1024, 2048, 3072, 4096-bit, DER)
Overview
Generates a fresh RSA keypair of the selected modulus size (1024, 2048, 3072 or 4096 bits) and public exponent (e = 65537 or 3) using the platform's cryptographically secure key generator. Every run produces a new, unrelated keypair, so connect the outputs to a fixed value only if you want to keep one key for later runs.
The keys leave the node as DER bytes, not as text. The public key is a SubjectPublicKeyInfo (SPKI) structure and the private key is a PKCS#8 PrivateKeyInfo structure. This is the same convention as the ECC Key Generator: there is no PEM output. If you need PEM for another tool, convert the DER outside NodeCrypto (the Base64 of the DER wrapped in BEGIN/END lines is exactly a PEM file).
Both outputs are plain Bytes, so they connect straight to RSA Encrypt, RSA Decrypt, RSA Sign and RSA Verify, or into RSA Key Decoder to read out the numbers N, e and d.
When to Use
- Creating a test keypair for RSA-OAEP encryption or RSA-PSS / PKCS#1 v1.5 signatures.
- Looking at the actual numbers inside an RSA key: generate a key, then send the private key to RSA Key Decoder.
- Producing standard SPKI and PKCS#8 DER files to compare with another implementation.
Parameter Configuration
| Parameter (ID) | Type & Default | Visibility Condition | Description & Options |
|---|---|---|---|
Key Size (Modulus Bits)modulusLength |
selectDefault: 2048 |
Always visible | Bit length of the modulus N. Larger keys are stronger and slower: generation time grows quickly with the size, and 4096 can take several seconds in a browser.
|
Public Exponent (e)publicExponent |
selectDefault: 65537 |
Always visible | The public exponent e stored in the key.
|
Port I/O Specification
See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.
Input Ports
This node has no input ports.
Output Ports
Port Nature: Fixed Output Ports (2 total).
| Port Name | Port ID | Data Type | Visibility Condition | Description |
|---|---|---|---|---|
Public Key |
publicKeyDer |
Bytes |
Always visible | The RSA public key as a DER-encoded SubjectPublicKeyInfo (SPKI). Safe to share. |
Private Key |
privateKeyDer |
Bytes |
Always visible | The RSA private key as a DER-encoded PKCS#8 PrivateKeyInfo. It contains the private exponent and the prime factors, so handle it like a password and never share it. |
Error Cases
This node has no runtime failure cases and always succeeds for any valid parameter choice.
Examples
Generating a 2048-bit RSA Keypair for Encryption or Signing
Create an RSA-2048 keypair and wire the outputs to the RSA nodes.
- Leave Key Size at
2048-bit (Standard)and Public Exponent at65537. - Connect
Public Keyto RSA Encrypt andPrivate Keyto RSA Decrypt. For signatures, sendPrivate Keyto RSA Sign andPublic Keyto RSA Verify.
Looking Inside a Generated Key
See the numbers that make up the keypair.
- Connect
Private Keyto RSA Key Decoder and set its Key Type toPrivate. - The outputs
N,e,d,p,q,dP,dQandqInvshow every component. With a 2048-bit key,Nis 256 bytes andeis01 00 01. - Feed
N,eanddinto RSA Key Encoder to rebuild the same private key bytes.