RSA Key Generator

Category: Asymmetric & Elliptic Curve · Node Type ID: asymmetric-rsa-keygen

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

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Key Size (Modulus Bits)
modulusLength
select
Default: 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.
  • 1024: 1024-bit (Legacy / Test). About 80 bits of security, broken for real use; keep it for tests and teaching.
  • 2048: 2048-bit (Standard). About 112 bits of security, the usual minimum today.
  • 3072: 3072-bit (High Security). About 128 bits of security.
  • 4096: 4096-bit (Ultra Security). Larger and slower, with a modest security gain over 3072.
Public Exponent (e)
publicExponent
select
Default: 65537
Always visible The public exponent e stored in the key.
  • 65537: 65537 (0x10001, the standard Fermat prime F4). Use this unless you have a reason not to.
  • 3: 3 (0x03, fast verification). Valid, and handy for teaching or for checking another system, but small exponents are weaker when messages are not padded; the RSA nodes always pad (OAEP, PSS, PKCS#1 v1.5), so the main risk is interoperability: many tools and standards reject e = 3.

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 NamePort IDData TypeVisibility ConditionDescription
Public Key publicKeyDer Bytes (DER) Always visible The RSA public key as a DER-encoded SubjectPublicKeyInfo (SPKI). Safe to share.
Private Key privateKeyDer Bytes (DER) 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.

  1. Leave Key Size at 2048-bit (Standard) and Public Exponent at 65537.
  2. Connect Public Key to RSA Encrypt and Private Key to RSA Decrypt. For signatures, send Private Key to RSA Sign and Public Key to RSA Verify.

Looking Inside a Generated Key

See the numbers that make up the keypair.

  1. Connect Private Key to RSA Key Decoder and set its Key Type to Private.
  2. The outputs N, e, d, p, q, dP, dQ and qInv show every component. With a 2048-bit key, N is 256 bytes and e is 01 00 01.
  3. Feed N, e and d into RSA Key Encoder to rebuild the same private key bytes.