RSA Key Generator
RSA Key Generator creates a pair of RSA keys (public and private) for the specified key size. Select a key size (e.g., 2048 bits) to generate keys for encryption and decryption. Note: For educational purposes only; do not use in production due to insufficient randomness.
Methodology Used in RSA Key Generator
RSA (Rivest-Shamir-Adleman) is a public-key cryptosystem used for secure data transmission. It generates a key pair: a public key for encryption and a private key for decryption.
Algorithm Steps:
1. Select a key size \( n \) (e.g., 2048 bits).
2. Generate two large prime numbers \( p \) and \( q \).
3. Compute the modulus \( N = p \times q \).
4. Compute \( \phi(N) = (p-1)(q-1) \).
5. Choose a public exponent \( e \) (typically 65537) coprime to \( \phi(N) \).
6. Compute the private exponent \( d \) such that \( d \cdot e \equiv 1 \pmod{\phi(N)} \).
7. Output the public key \( (e, N) \) and private key \( (d, N) \) in PEM format.
Mathematical Formulation:
\[ \text{Modulus: } N = p \times q \] \[ \text{Public key: } (e, N), \quad \text{Private key: } (d, N) \] \[ \text{Encryption: } c = m^e \mod N \] \[ \text{Decryption: } m = c^d \mod N \]Note: This tool uses the jsrsasign library for key generation. Keys generated in the browser are not cryptographically secure for production use due to limited randomness sources.
Example
For a small key size (e.g., 512 bits for simplicity):
Let \( p = 61 \), \( q = 53 \):
\[ N = 61 \times 53 = 3233 \] \[ \phi(N) = (61-1)(53-1) = 60 \times 52 = 3120 \] \[ e = 17 \text{ (coprime to 3120)} \] \[ d = 2753 \text{ (since } 17 \times 2753 \equiv 1 \pmod{3120}) \]Public key: \( (17, 3233) \), Private key: \( (2753, 3233) \).