RSA Key Pair Generator

Generate client-side PKCS#8 (Private) and SPKI (Public) PEM keys (1024, 2048, 4096-bit) via Web Crypto.

Developer & Code
100% Client-Side · Local Data Processing
RSA Key Pair Generator

Generate client-side PKCS#8 (Private) and SPKI (Public) PEM keys (1024, 2048, 4096-bit) via Web Crypto.

Concept & Knowledge Hub

RSA Key Pair Generator, 2048 / 4096-Bit Public & Private PEM Key Factory

Asymmetric cryptography relies on mathematically paired public and private keys to secure SSH terminal connections, encrypt confidential communications, and authenticate digital signatures. The RSA Key Pair Generator synthesizes cryptographically secure RSA key pairs directly in browser memory using the W3C Web Cryptography API, exporting standard PEM-formatted Public and Private keys alongside SHA-256 fingerprint hashes.

A cloud infrastructure engineer provisions a secure staging SSH access key. In the generator interface, the engineer configures: Key Size: 2048 bits, Hash Algorithm: SHA-256, and Purpose: Signing & Verification (RSASSA-PKCS1-v1_5). Clicking Generate RSA Key Pair invokes crypto.subtle.generateKey() using the standard public exponent 65537 (0x010001). The browser synthesizes the key pair, exporting the Public Key in SubjectPublicKeyInfo (SPKI) PEM format (-----BEGIN PUBLIC KEY-----...) and the Private Key in PKCS#8 PEM format (-----BEGIN PRIVATE KEY-----...), along with an SHA-256 key fingerprint hash. The engineer copies the public key to configure remote server authentication.

Key generation runs locally using native cryptographic entropy from the operating system's hardware RNG, guaranteeing that private keys are never transmitted across the network.

Core Architecture & Mathematical Formula

RSA Keygen: crypto.subtle.generateKey({ name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048 | 4096, publicExponent: [0x01, 0x00, 0x01], hash: 'SHA-256' })

Generates large pseudo-prime integer pairs (p and q); computes RSA modulus n = p × q; exports standard SPKI public and PKCS#8 private PEM armor blocks.

Best Practices & Essential Guidelines

  • Select 4096-Bit Modulus for High-Security Long-Term Keys: While 2048-bit keys provide adequate baseline security for routine testing, 4096-bit keys offer substantial cryptographic defense margins for enterprise master certificates.
  • Protect the Private Key with Absolute Confidentiality: Never share, commit, or publicly distribute the Private Key (PKCS#8). The Public Key is safe to distribute publicly, but possessing the private key grants full decryption and impersonation capabilities.
  • Verify Key Fingerprint Hashes on Remote Hosts: Use the generated SHA-256 key fingerprint to verify that imported public keys match expected credentials across remote server authorized_keys lists.
  • Recognize Generation Latency on 4096-Bit Keys: Generating 4096-bit RSA keys requires finding two 2048-bit probable prime numbers; key generation may take several seconds on mobile or lower-powered CPUs.

Frequently Asked Questions (FAQ)

What is the difference between a Public Key and a Private Key?
The Public Key is shared openly with the world to encrypt messages or verify signatures you create. The Private Key is kept secret on your device, used to decrypt messages sent to you or generate authenticated digital signatures.
What formats are used for the exported keys?
Keys are exported in standard PEM format (Base64-encoded ASN.1 DER with header armor): SubjectPublicKeyInfo (SPKI) for public keys, and PKCS#8 for private keys, universally compatible with OpenSSH, OpenSSL, and cloud IAM providers.
Why is the public exponent fixed to 65537 (0x010001)?
65537 is the fourth Fermat prime (2^16 + 1). It provides an optimal balance between fast cryptographic exponentiation efficiency and strong resistance to low-exponent mathematical attacks.
Are the generated private keys ever transmitted over the internet?
No. Key pair generation executes 100% locally via the browser's native Web Crypto API (crypto.subtle). Your private keys are generated in volatile device memory and never leave your computer.