企评社

Interface labels are shown in English. Company reviews, forum posts and tool descriptions are currently available in Chinese only.

RSA key pair generator

2048 / 3072 / 4096 bits · SPKI public key plus PKCS#8 private key · JWK and modulus fingerprint included

只在你浏览器里生成,私钥不上传、不落盘,刷新即消失

为什么私钥可以"只在你浏览器里"

密钥生成是纯数学运算。RSA 密钥对的生成只需要随机大数与模幂运算,这些运算现代浏览器的 Web Crypto 接口(背后常是操作系统/硬件的加密实现)都能直接完成。生成 2048 位密钥通常不到一秒,3072 / 4096 位也就多等几百毫秒——根本不需要把任何东西交给服务器。这也意味着:你的私钥从头到尾没有离开过这台设备,不存在"被服务器留存"的可能。

SPKI 与 PKCS#8 是两种标准容器。公钥按 SPKI(Subject Public Key Info)编码、私钥按 PKCS#8 编码,外面都包上 PEM 的 base64 与 BEGIN/END 头。这是目前最通用的两种格式:Nginx 的证书链、JWT 的 RS256 签名、OpenSSL 命令行都直接认。老式的 PKCS#1 私钥(BEGIN RSA PRIVATE KEY)本页不输出,需要时用 openssl pkey 转换即可。

模数指纹用来核对"是不是同一把公钥"。两把公钥是否相同,直接比文本容易看花眼;把公钥的模数(n)做 SHA-256 得到的短指纹则稳定可比。你在不同工具里生成或导入同一把公钥时,指纹一致就说明是同一条。

FAQ

Can I use the generated key pair directly?

Yes. It is generated with the browser's built-in Web Crypto (RSASSA-PKCS1-v1_5 + SHA-256): the public key is SPKI and the private key is PKCS#8, both standard PEM text, ready for Nginx, JWT signing, OpenSSL and the like; you can double-check them with openssl pkey.

Is the private key uploaded?

No. Generation, export and display all happen inside your browser; the private key exists only in this page's memory, is never written to localStorage and never appears in any network request, and reloading makes it vanish - this page has no upload endpoint at all.

How to choose between 2048 / 3072 / 4096?

2048 bits meets current security requirements and has the best compatibility; 3072 bits (about 128-bit security strength) suits long-term use; 4096 bits is safer but signing and verifying get noticeably slower. For ordinary web and API signing, 2048 or 3072 is enough.

What are SPKI and PKCS#8?

SPKI carries the public key, PKCS#8 the private one (the unencrypted form). This page does not output the old-style PKCS#1 private key; if a receiver asks for PKCS#1, one openssl pkey command converts between the two formats.

Why can some pages not generate here?

Browsers only expose the crypto.subtle key-generation API in a secure context (https or localhost); open this page over plain http and it shows a notice and disables the generate button.

Related tools