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.
Generates an RSA key pair for educational purposes.
Generates an RSA key pair for educational purposes.
2048 bits
-----BEGIN PRIVATE KEY----- ... -----BEGIN PUBLIC KEY----- ...
Both keys are emitted in PEM format.
The private key signs/decrypts; the public key verifies/encrypts.
Your input is sent to YAS infrastructure because the tool requires server-side processing or public network queries. Input is not stored.
curl -X POST "https://yas.sh/api/v1/tools/rsa-generator" \
-H "Content-Type: application/json" \
-d '{"bits":2048}'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();import requests
r = requests.post("https://yas.sh/api/v1/tools/rsa-generator", json={"bits":2048})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| bits | integer | No (default 2048) | 1024–4096 |
{ "bits": 2048, "publicKey": "-----BEGIN PUBLIC KEY-----...", "privateKey": "-----BEGIN PRIVATE KEY-----..." }Generate an RSA keypair (educational).
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).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.
Generating a keypair and inspecting the modulus, exponents and PEM armor makes the abstract description concrete. This is the tool's primary purpose.
Verifying that a JWT library, a signing routine or a config loader accepts a well-formed RSA key does not require a production key.
Showing that the public key encrypts and only the private key decrypts is far more convincing with real generated values.
PKCS#1 and PKCS#8 armor differ, and libraries are picky. Generating a sample shows which form your code accepts.
What this tool deliberately does not do, and where it will disagree with other implementations.