Crypto tools

RSA key pair generate

Generate an RSA key pair, on your device; the private key never leaves your browser.

Runs on your device. The file is never uploaded.

RSA key pair generate prints two PEM blocks from crypto.subtle: the SPKI public block, then the PKCS8 secret block. Purpose defaults to encrypt and yields an RSA-OAEP key, while sign yields RSA-PSS. The modulus is 2048 bits unless raised to 3072 or 4096. A key built for one purpose will not import into the other pair of tools.

Options

Questions

Does my private key leave the browser?

No. The pair is generated by crypto.subtle.generateKey inside this tab and exported to PEM in the page. Nothing is uploaded, no key is stored, and the site can do this with the network off. That also means the key exists only in the text you copy out. Close the tab without saving the private block and it is gone, and nobody can regenerate the same pair for you.

Should I pick encrypt or sign?

Match it to what you will do next. purpose=encrypt makes an RSA-OAEP key with SHA-256, for RSA-OAEP encrypt and RSA-OAEP decrypt. purpose=sign makes an RSA-PSS key with SHA-256, for RSA-PSS sign and RSA-PSS verify. The default is encrypt. Web Crypto ties a key to one algorithm at import time, so an OAEP key will not load into the signing tools or the other way round. Generate a separate pair for each job.

What key size should I choose?

2048, 3072 or 4096 bits, with 2048 as the default. The public exponent is 65537 in every case. Larger moduli take noticeably longer to generate in a browser tab and make every later operation slower, and they also raise the ceiling on how much RSA-OAEP encrypt can take. The tool does not recommend a size; pick what the system you are working with expects.

What format do I get?

Two PEM blocks in one text result: the public key as SPKI in a BEGIN PUBLIC KEY block, a blank line, then the private key as PKCS8 in a BEGIN PRIVATE KEY block. Both are standard forms that OpenSSL and most libraries read directly. The private key is not password protected; it is plain PKCS8, so the copied text is the secret in full.

Can I use this key for TLS or SSH?

Not as it stands. This tool outputs a bare key pair and nothing else. There is no certificate, no CSR and no OpenSSH format conversion here. The PKCS8 private key and the SPKI public key are the raw ingredients; turning them into a certificate or an SSH key happens elsewhere.

Is the randomness good enough?

It is whatever your browser provides. Generation goes through crypto.subtle.generateKey, which uses the platform cryptographic random source, the same one behind crypto.getRandomValues. The tool adds no randomness of its own and cannot audit yours. If you do not trust the device or the browser you are on, do not generate long-lived keys on it.

Related Crypto tools