Skip to main content
UFOZoo

RSA/ECDSA Key Generator: PEM Keys for SSH, TLS & JWT

Generate RSA and ECDSA key pairs online for SSH, TLS, JWT, and OpenSSL. Export as PEM with selectable key sizes and curves.

Updated 2026-08-16

Related Tools

Features

  • Two algorithm modes: RSA (2048/4096 bit) and ECDSA (P-256/P-384/P-521) for flexible cryptographic needs
  • Standard PEM output: exports public key in SPKI format and private key in PKCS#8 format, compatible with OpenSSL and most crypto libraries
  • Secure key generation: uses the Web Crypto API (crypto.subtle.generateKey) for cryptographically secure random key material
  • One-click copy: copy each key separately with a single click, with visual feedback
  • Save as .pem file: save public and private keys as individual PEM files
  • Generation status feedback: a spinner shows while the browser computes the key, so you know generation is in progress
  • Public and private keys displayed side by side in PEM format, each with its own copy and download buttons
  • Client-side key generation: keys are created locally on your device and private keys never leave it

How to Use

  1. 1Select the key algorithm: RSA for asymmetric encryption or ECDSA for digital signatures and modern applications.
  2. 2Choose the key size: for RSA select 2048 (default, recommended) or 4096 bits; for ECDSA select P-256, P-384, or P-521 curve.
  3. 3Click Generate; the tool creates a cryptographically secure key pair using the browser's Web Crypto API.
  4. 4Review the public and private keys displayed in PEM format. Click Copy to copy a key to your clipboard.
  5. 5Click Download to save a key as a .pem file for use in OpenSSL, SSH, or server configuration.
  6. 6While generating, a spinner appears: RSA 2048-bit usually takes 2-5 seconds and 4096-bit 10-30 seconds on slower devices, while ECDSA finishes in under a second.
  7. 7Use the public key with TLS/SSL certificates: create a CSR with OpenSSL using your private key, then submit to a certificate authority.
  8. 8Use the key pair for JWT signing: configure your auth server to use the private key for signing tokens and distribute the public key for verification.

Frequently Asked Questions

What is the difference between RSA and ECDSA?

RSA is the most widely used asymmetric encryption algorithm, ideal for encryption, digital signatures, and key exchange. It is supported everywhere but requires larger key sizes (2048–4096 bits). ECDSA (Elliptic Curve Digital Signature Algorithm) provides equivalent security with much smaller key sizes: P-256 is comparable to RSA 3072. ECDSA is faster for signing and is the preferred choice for modern applications including blockchain, JWTs, and TLS certificates.

What key sizes should I use?

For RSA, 2048 bits is the current industry standard and recommended for most applications. 4096 bits provides a higher security margin but is significantly slower for key generation and cryptographic operations. For ECDSA, P-256 (secp256r1) is the most widely supported and recommended for general use. P-384 is required by some government standards (NSA Suite B). P-521 offers the highest security but has limited compatibility.

What is PEM format and how do I use these keys?

PEM (Privacy Enhanced Mail) is a standard Base64-encoded format with header/footer lines. Public keys use BEGIN PUBLIC KEY / END PUBLIC KEY (SPKI format per RFC 5280). Private keys use BEGIN PRIVATE KEY / END PRIVATE KEY (PKCS#8 format per RFC 5208). These PEM files are compatible with OpenSSL, OpenSSH, Node.js crypto, Python cryptography, TLS servers, JWT libraries, and most cryptographic tools.

How do I tell which key is the public key and which is the private key?

The PEM headers say it directly: public keys start with -----BEGIN PUBLIC KEY----- (SPKI format), private keys with -----BEGIN PRIVATE KEY----- (PKCS#8). On OpenSSH systems, id_rsa is the private key and id_rsa.pub the public key. A common trap: some tools export the private key with an RSA/EC-specific header like -----BEGIN RSA PRIVATE KEY-----; those are the older PKCS#1 format and still private. Never share anything marked PRIVATE, and note that the private key can always derive the public key, never the other way around.

Can I generate an Ed25519 key pair here?

No. This tool generates RSA and ECDSA only. Ed25519 is a separate curve that browsers' Web Crypto API does not expose to web pages yet. For Ed25519 use ssh-keygen -t ed25519 on the command line, or OpenSSL (openssl genpkey -algorithm ED25519). If you only need signing and your target system supports it, ECDSA P-256 is the closest equivalent this tool can generate.

Can I import these keys into other systems?

Yes. The PEM format is universally supported. For Node.js, use crypto.createPublicKey() and crypto.createPrivateKey(). For Python, use cryptography library's load_pem_private_key() and load_pem_public_key(). For OpenSSL, use openssl pkey -in key.pem. For JWTs, the public key can be used to verify signatures and the private key to sign. For TLS, configure the private key and certificate (generated from the public key) in your web server.

Why is key generation sometimes slow?

RSA key generation, especially 4096-bit, requires finding large prime numbers and can take several seconds depending on your browser and device. This is normal and indicates that true random number generation is happening. ECDSA key generation is typically much faster (under a second) because it does not require prime generation. The progress bar shows the generation status.

Why is the key pair different every time I generate?

Because the keys are random; that is the point. Each generation draws fresh random key material, so the pair is different every time, including when you regenerate with the same algorithm and size. You must save the keys you plan to use once; anything encrypted, signed, or configured with an older pair stops working with a new one. There is no way to 'regenerate the same key'; if you lose a private key, the pair is gone permanently.

Can I generate keys for SSH authentication?

RSA PEM keys can be used with SSH after format conversion. To extract the SSH public key format, run: ssh-keygen -f public-key.pem -i -m PKCS8. For SSH private keys, the PEM format may need conversion to OpenSSH format using: ssh-keygen -p -m PEM -f private-key.pem. ECDSA P-256 keys work with OpenSSH 6.5+ natively.

What is the difference between PKCS#8 and SPKI PEM formats?

PKCS#8 (Private-Key Information Syntax Standard, RFC 5208) is the standard format for private keys, wrapping the key data with algorithm identification. SPKI (Subject Public Key Info, RFC 5280) is the standard format for public keys, containing the algorithm and key data. Both are universally supported: OpenSSL, Node.js, Python, Java, and Go all use these formats natively.

Why does my private key start with BEGIN PRIVATE KEY instead of BEGIN RSA PRIVATE KEY?

The two headers mean different formats. -----BEGIN PRIVATE KEY----- is PKCS#8 (RFC 5208), the modern standard this tool exports; -----BEGIN RSA PRIVATE KEY----- is the older PKCS#1 (RFC 8017) layout. OpenSSL 3.x, Node.js, Python, Java, and Go all accept PKCS#8 natively. If a legacy system insists on PKCS#1, convert with: openssl rsa -in key.pem -out key.pkcs1.pem.

Why can't I recover a private key if I lose it?

Public keys can be derived from a private key, but the reverse is computationally impossible: that is the foundation of asymmetric crypto (RSA/ECDSA). If you lose the private key, the pair is gone permanently: anything encrypted, signed, or configured with it must be redone with a new pair from this rsa/ecdsa key generator. Back up the private key (encrypted) the moment you generate it.