wire / wire-format / rsa
RSA is a public-key cryptosystem. Key generation: choose two large primes p, q; n = p*q; φ(n) = (p-1)(q-1); choose e (public exponent, typically 65537); d = e^(-1) mod φ(n) (private exponent). Encryption: c = m^e mod n. Decryption: m = c^d mod n. Signature: s = m^d mod n. Verify: m = s^e mod n. Padding: PKCS#1 v1.5 or OAEP (encryption), PSS (signature).
aka: RSA (Rivest-Shamir-Adleman)
spec: RFC 8017 (PKCS #1)
RSA is a public-key cryptosystem. Key generation: choose two large primes p, q; n = p*q; φ(n) = (p-1)(q-1); choose e (public exponent, typically 65537); d = e^(-1) mod φ(n) (private exponent). Encryption: c = m^e mod n. Decryption: m = c^d mod n. Signature: s = m^d mod n. Verify: m = s^e mod n. Padding: PKCS#1 v1.5 or OAEP (encryption), PSS (signature).
| field | size | meaning |
|---|---|---|
| Modulus (n) | 2048/3072/4096 bits | n = p * q. Product of two large primes. |
| Public exponent (e) | 17/32 bits | Typically 65537 (0x10001). Must be coprime to φ(n). |
| Private exponent (d) | same as n | d = e^(-1) mod φ(n) (or mod λ(n) for CRT optimization). |
| Prime p | half of n | First large prime. |
| Prime q | half of n | Second large prime. |
| CRT parameters | for fast decryption | dp = d mod (p-1), dq = d mod (q-1), qinv = q^(-1) mod p. Enables 4x faster decryption. |
| Encryption | operation | c = m^e mod n (modular exponentiation). |
| Decryption | operation | m = c^d mod n (or CRT: m1 = c^dp mod p, m2 = c^dq mod q, then CRT combine). |
| Padding (OAEP) | for encryption | Optimal Asymmetric Encryption Padding: adds randomness and structure to prevent attacks. |
| Padding (PSS) | for signature | Probabilistic Signature Scheme: randomized padding for signatures. |
example:
00 00 00 00
RSA (placeholder)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/rsa
or /wire-format/rsa.json