Skip to content
YAS.SH
Security🌐 YAS server-sideAPI availableadvanced

RSA Key Generator

Generates an RSA key pair for educational purposes.

Processed by YAS · not stored
Ready to runInstant execution
All tools →
Loading tool…

What does this tool do?

Generates an RSA key pair for educational purposes.

Why would I use it?

  • You want to understand RSA key formats (PEM, public/private).
  • You need throwaway keys for local testing.
  • You are learning how key sizes affect output.

Real-life example

Input
2048 bits
Output
-----BEGIN PRIVATE KEY----- ... 
-----BEGIN PUBLIC KEY----- ...

Both keys are emitted in PEM format.

Input → Process → Output → Next

Input
Choose bit size.
Process
YAS generates the key pair server-side.
Output
PEM-encoded private and public keys.
Next action
Use them only for testing — generate real keys locally with ssh-keygen/openssl.

Common mistakes

  • Using generated keys in production.
  • Sharing the private key.
  • Choosing small key sizes (2048 minimum today).

What the result means

The private key signs/decrypts; the public key verifies/encrypts.

Privacy & security

Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.

API

Endpoint
POST https://yas.sh/api/v1/tools/rsa-generator
Request Header
Content-Type: application/json
cURL
curl -X POST "https://yas.sh/api/v1/tools/rsa-generator" \
  -H "Content-Type: application/json" \
  -d '{"bits":2048}'
JavaScript
const res = await fetch("https://yas.sh/api/v1/tools/rsa-generator", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "bits": 2048
}),
});
const data = await res.json();
Python
import requests

r = requests.post("https://yas.sh/api/v1/tools/rsa-generator", json={"bits":2048})
data = r.json()
FieldTypeRequiredDescription
bitsintegerNo (default 2048)1024–4096
Success response
{ "bits": 2048, "publicKey": "-----BEGIN PUBLIC KEY-----...", "privateKey": "-----BEGIN PRIVATE KEY-----..." }

Generate an RSA keypair (educational).

Error responses
  • 400 VALIDATION_ERROR — invalid input or unsupported option.
  • 413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.
  • 429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).
Limits
  • Maximum input: 64 KB per request.
  • Rate limit: 60 requests/min per IP address.
  • Authenticated accounts benefit from higher tier quotas.

RSA Key Generator: technical reference, use cases and FAQ

How RSA Key Generator works

RSA key generation picks two large random primes p and q, forms the modulus n = p·q, and derives a private exponent d as the modular inverse of the public exponent e modulo λ(n). Security rests on the difficulty of factoring n: recovering p and q from the public key is what breaks the scheme, and the best known classical algorithms make that infeasible at 2048 bits and above with current hardware.

Prime generation is the expensive and delicate part. Candidates are drawn from a cryptographic random source and subjected to probabilistic primality testing; weak randomness here produces keys that share factors with other keys, a failure that has been found in the wild across embedded devices whose entropy pool was not seeded at first boot.

When to use it: real-world scenarios

Learning how asymmetric keys are structured

Generating a keypair and inspecting the modulus, exponents and PEM armor makes the abstract description concrete. This is the tool's primary purpose.

Producing a throwaway keypair for a local test

Verifying that a JWT library, a signing routine or a config loader accepts a well-formed RSA key does not require a production key.

Demonstrating public/private key mechanics in teaching

Showing that the public key encrypts and only the private key decrypts is far more convincing with real generated values.

Checking key format compatibility

PKCS#1 and PKCS#8 armor differ, and libraries are picky. Generating a sample shows which form your code accepts.

Pro tips

  • Use Ed25519 or ECDSA P-256 for new systems where you have the choice. Both give equivalent or better security with far smaller keys and faster operations.
  • If you must use RSA, 2048 bits is the current floor and 3072 is the sensible default for anything with a lifetime beyond a few years.
  • Never encrypt with textbook RSA. Real deployments use OAEP for encryption and PSS for signatures; raw RSA is deterministic and malleable.
  • The public exponent 65537 is standard for good reasons — small enough to be fast, large enough to avoid the low-exponent attacks that plague e = 3.

Limitations and edge cases

What this tool deliberately does not do, and where it will disagree with other implementations.

  • Keys generated in a browser-adjacent context are for education and testing. Production keys should be generated on the system that will use them, ideally in an HSM or a hardware-backed keystore.
  • No passphrase protection is applied to the private key output.
  • Generation time grows steeply with key size; 4096-bit generation is noticeably slow.
  • This page is deliberately excluded from advertising, because a page handling key material should not carry third-party scripts.

Frequently asked questions

Is it safe to use a key generated here in production?
No, and it is not intended for that. Production keys should be generated on the machine or HSM that will hold them, so the private key never crosses a boundary at all.
What key size should I choose?
2048 bits minimum, 3072 for longer-lived keys. Below 2048 is deprecated; 4096 gives limited additional margin at a real performance cost.
Should I use RSA or Ed25519?
Ed25519 where both ends support it: smaller keys, faster signing, fewer parameters to get wrong. RSA remains necessary for compatibility with older systems and some certificate authorities.
Why does generation take several seconds?
Finding two large probable primes requires many candidate draws and primality tests. The cost rises sharply with key size, which is why 4096-bit generation is much slower than 2048.
Ask YAS AI
🍪 Cookies & privacy. Essential cookies keep you signed in and remember language and theme. Google AdSense and reCAPTCHA are Google technologies: AdSense runs only after Accept All; reCAPTCHA loads on sign-in and contact forms. See how Google uses data: https://policies.google.com/technologies/partner-sites cookie policy · privacy policy.
Settings