Online RSA key generation

 
 
RSA (Rivest, Shamir and Adleman) is an asymmetric (or public-key) cryptosystem which is often used in combination with a symmetric cryptosystem such as AES (Advanced Encryption Standard).
RSA is not intended to encrypt large messages. RSA is much slower than other symmetric cryptosystems.

In practice, Bob typically encrypts a secret large message with a symmetric algorithm. The comparatively short symmetric key is than encrypted with RSA. Both the RSA-encrypted symmetric key and the symmetrically-encypted message are transmitted to Alice.

This service allows you to create an RSA key pair consisting of an RSA public key and an RSA private key.

The RSA public key is used to encrypt the plaintext into a ciphertext and consists of the modulus n and the public exponent e. Anyone is allowed to see the RSA public key.

To decrypt the ciphertext, this tool creates two private keys which can be used independently:
  • Private key A
    The RSA private key consists of the modulus n and the private exponent d. Only the owner of the key pair is allowed to see the private exponent. The modulus however is public.

  • Private key B
    Private key B uses the Chinese Remainder Theorem (CRT) which decypts the ciphertext 4 times faster as private key A. Only the owner of this key pair is allowed to see the below mentioned values.
    Private key B consists of:
    • CRT exponent 1 (dP)
    • CRT exponent 2 (dQ)
    • CRT coefficient (qInv)
    • Prime number p
    • Prime number q
All values created by this tool can also be created by using the OpenSSL tool or the online Create self-signed SSL certificates tool.

To manually create the public and private keys, type the following OpenSSL commands:

openssl genrsa -out rsa_privatekey.pem 1024
openssl rsa -out rsa_keys.txt -text -in rsa_privatekey.pem


The rsa_keys.txt file contains the following information:

Private-Key: (2048 bit)
modulus:
    00:dd:4f:91:e3:28:03:0a:19:20:60:90:10:7c:26:
    cd:86:c3:ac:a4:a1:ff:ae:35:b7:d7:ba:8f:47:9c:
    f0:16:b6:30:4c:08:ed:dc:17:b7:0e:8e:87:dd:71:
    e2:b4:48:aa:84:0f:87:4a:e8:13:3d:ec:a0:db:0e:
    cc:59:ae:bc:9c:b4:42:72:70:78:7e:07:92:db:91:
    79:f0:a5:4a:79:99:e2:62:0f:60:4d:d3:3e:b2:f8:
    20:02:95:63:0b:4a:79:a6:06:d6:44:2f:5b:9b:e8:
    23:bf:89:28:41:4d:85:89:d7:f2:c1:88:90:0e:23:
    b9:69:97:c5:81:6c:a6:a6:53:b2:92:43:3f:cc:87:
    a7:68:cd:78:44:42:79:fb:99:e8:70:00:7c:76:0e:
    15:77:fe:d0:dd:a0:e7:11:bf:9e:ba:cc:1c:b7:73:
    b1:60:30:78:0f:63:4b:68:66:43:c5:91:5f:cf:bc:
    61:d5:86:a1:b8:ff:13:5e:a3:f7:c2:46:e9:d7:b1:
    3f:4c:a4:b3:28:a2:80:7d:ec:32:0b:bb:00:6a:46:
    29:21:40:4e:3c:89:2e:fd:2b:59:d4:9a:b8:2b:97:
    bb:94:26:f7:1a:55:3f:0b:dd:d6:85:b0:1c:e3:58:
    0b:dd:e4:5a:c0:c3:b6:72:3a:42:40:0b:5a:11:65:
    b4:f1
publicExponent: 65537 (0x10001)
privateExponent:
    00:a5:e8:02:ab:d1:d1:05:7e:f4:a0:af:1f:4c:93:
    22:3c:46:f0:63:b2:f6:23:b9:2d:8a:d1:d6:9b:8e:
    f1:05:75:ab:1b:35:0e:6b:92:73:ae:bb:f6:ea:71:
    77:cc:43:35:61:2e:ea:f3:a2:aa:da:1f:4c:2f:2c:
    16:d1:9c:86:d4:ca:e5:8d:38:f7:7b:33:5e:4a:af:
    f2:44:0f:05:97:c7:5e:c8:b8:52:2f:c5:8f:19:47:
    9d:67:92:69:df:8b:03:4b:0d:91:0f:28:99:7a:75:
    3a:67:5a:01:0d:83:79:fa:6e:23:14:26:b6:27:83:
    6c:79:d6:47:3f:d1:1d:d5:4d:40:49:2f:39:46:05:
    16:7b:41:6a:3e:dc:76:2e:90:43:b2:b0:19:ef:46:
    f8:cf:24:fd:f5:41:aa:b5:c2:47:a2:85:10:06:70:
    16:14:48:3d:02:83:93:d8:e8:11:3e:eb:6e:d4:43:
    e5:13:ec:1e:84:33:ac:77:e5:9a:cb:bc:55:fa:fa:
    12:61:dc:84:e9:67:dd:47:60:29:93:33:c8:60:ed:
    96:0a:a5:22:28:06:67:3b:03:b3:fe:6f:4b:81:7c:
    0c:e2:1f:4d:b4:93:38:11:6a:4a:e1:69:1e:85:de:
    7d:40:fd:40:d4:4f:8f:ef:7a:4a:c8:61:2a:9a:9d:
    6e:09
prime1:
    00:f7:7d:ae:81:2a:55:0e:20:a9:5c:52:bf:d7:48:
    c6:c6:e1:f7:69:d5:b4:03:3d:54:ec:1b:56:92:c8:
    93:40:bc:5d:68:5e:fd:dc:97:b0:b1:0b:b7:71:10:
    3b:94:9b:56:d6:0d:31:0a:3d:6b:06:0a:44:f3:ff:
    53:16:e6:87:6d:0b:83:1a:51:15:ed:c3:5a:0d:8f:
    79:57:0a:33:df:35:56:23:f4:62:de:34:87:24:ff:
    d1:0f:1c:95:b9:86:5d:66:d6:62:e0:47:44:ef:fc:
    ca:4d:6c:8e:b6:f1:e8:4b:14:23:e5:7b:aa:06:92:
    77:91:dc:38:7a:49:d9:05:73
prime2:
    00:e4:eb:76:05:2b:49:d3:46:54:0a:19:c3:a3:6c:
    35:1c:6e:d8:6e:e3:c0:95:dc:42:02:0d:50:c2:66:
    8e:6a:09:69:b3:0b:a4:e1:7c:21:45:21:1e:71:a8:
    dc:0b:48:cd:22:e4:7e:44:4e:24:34:15:18:43:ee:
    be:8c:80:4b:7f:e2:c8:aa:35:94:37:a7:cf:09:70:
    b5:31:56:ef:1b:03:47:b5:ee:24:af:20:5c:15:4c:
    c2:25:46:36:3c:5d:ed:6b:70:22:f1:ec:54:a3:5d:
    39:57:b3:dd:cb:9e:6f:8f:44:c5:e0:cc:ab:5d:92:
    46:d7:2f:5f:99:42:6d:63:0b
exponent1:
    00:a1:99:fe:5d:36:f0:0c:e6:84:cf:d4:f4:91:35:
    63:1e:30:24:66:85:f5:21:fc:65:3c:3a:69:a0:34:
    b9:fa:16:45:03:c6:ab:0a:e4:3d:aa:8d:54:fd:cd:
    b4:a9:c7:78:bf:12:24:08:64:ac:42:68:68:37:ce:
    6b:49:d3:c3:70:0f:89:4e:a0:cd:a9:cf:da:38:6a:
    8b:b7:aa:e0:ce:09:bc:b2:83:7c:1f:4d:bb:45:0c:
    89:4c:cd:c4:72:3c:eb:36:20:1c:b6:07:b3:5a:e4:
    fc:8f:eb:a7:90:8b:8a:bb:a3:6e:01:05:6b:b3:18:
    e6:5c:66:a8:b6:29:0c:3d:43
exponent2:
    04:03:70:cd:44:66:05:f3:3c:b3:f4:a1:ae:72:ce:
    37:92:65:ef:03:c5:33:9b:69:f8:d9:3c:ea:3b:9c:
    11:95:da:a9:8d:f1:b5:16:55:0a:fe:3a:a7:69:7b:
    7a:23:2b:9d:89:fe:00:ba:91:fd:eb:c4:c2:24:24:
    69:18:32:ba:aa:42:34:61:be:18:7f:b3:ac:89:b2:
    53:8c:1f:a3:0c:9a:ac:40:e1:99:c4:6a:78:e1:20:
    a2:40:a9:e0:c3:10:cf:8a:66:c2:71:0f:46:d1:f2:
    98:6c:09:de:71:07:a9:ae:5d:fd:c3:f8:d9:2a:20:
    5d:d3:71:cc:a1:12:83:e3
coefficient:
    00:b9:46:2e:d0:4d:8b:07:ea:44:cd:ce:06:7c:21:
    f7:56:a5:a1:c5:ae:fa:15:e7:e9:71:97:86:30:6a:
    b2:ff:62:2d:37:73:e0:fd:2a:57:8a:b6:b8:75:0e:
    a3:76:1a:c5:ab:61:8d:01:0f:9e:47:10:9b:c0:a9:
    55:ac:43:ca:a7:49:d0:8a:3c:6f:1f:ff:18:76:34:
    0a:fd:95:18:60:dc:3b:0e:3d:8a:44:11:93:d8:2b:
    72:c0:e2:cb:0f:73:76:90:f0:fc:c9:f3:71:2d:00:
    ff:43:8d:f8:9c:df:99:1a:e3:b1:12:8d:c4:00:d1:
    f2:ab:8b:f3:e4:41:3e:4c:c3
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA3U+R4ygDChkgYJAQfCbNhsOspKH/rjW317qPR5zwFrYwTAjt
3Be3Do6H3XHitEiqhA+HSugTPeyg2w7MWa68nLRCcnB4fgeS25F58KVKeZniYg9g
TdM+svggApVjC0p5pgbWRC9bm+gjv4koQU2FidfywYiQDi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Y5lxmqLYpDD1DAoGABANwzURmBfM8s/ShrnLON5Jl7wPFM5tp+Nk8
6jucEZXaqY3xtRZVCv46p2l7eiMrnYn+ALqR/evEwiQkaRgyuqpCNGG+GH+zrImy
U4wfowyarEDhmcRqeOEgokCp4MMQz4pmwnEPRtHymGwJ3nEHqa5d/cP42SogXdNx
zKESg+MCgYEAuUYu0E2LB+pEzc4GfCH3VqWhxa76FefpcZeGMGqy/2ItN3Pg/SpX
ira4dQ6jdhrFq2GNAQ+eRxCbwKlVrEPKp0nQijxvH/8YdjQK/ZUYYNw7Dj2KRBGT
2CtywOLLD3N2kPD8yfNxLQD/Q434nN+ZGuOxEo3EANHyq4vz5EE+TMM=
-----END RSA PRIVATE KEY-----


If you enter the above mentioned prime numbers (p,q) and public exponent (e) in the tool below, it will calculate the same values for modulus (n), private exponent (d), CRT exponent 1 (dP), CRT exponent 2 (dQ) and CRT coefficient (qInv) as the OpenSSL tool.

More information about RSA can be found in The Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1 also known as RFC 3447



Input online RSA key generation:


Step 1: Enter or generate prime numbers
 
Generate prime numbers (p,q).
The key size is*:
Help bits           
 
  -- Or --
 
Prime number (p) is a *: Help      
Bitsize: 0
Enter prime number (p)*:
Help
 
Prime number (q) is a *: Help      
Bitsize: 0
Enter prime number (q)*:
Help
 
Euler's phi(n) is a: Help
Euler's phi(n) function:
phi(n) = (p - 1) * (q - 1)
Help
 
     

 
Step 2: Enter public exponent
 
Public exponent (e) is a *: Help
Public exponent (e)*: Help
 
     

 
Step 3: Generate public / private keys based on prime numbers and exponent
 
Convert generated keys to *: Help           
 
  -- Or --
 
Modulus (n) is a *: Help      
Bitsize: 0
     
Enter modulus (n)*:
n = p * q
Help
 
Public key (= public exponent e and modulus n)
 
Public exponent (e) is a *:
See step 2.
Help
Public exponent (e)*:
See step 2.
Help
 
Private key A (= private exponent d and modulus n)
 
Private exponent (d) is a *: Help           
Enter private exponent (d)*:
d = e-1 mod phi
Help
 
Private key B (= CRT exponent 1, CRT exponent 2 and CRT coefficient)
 
CRT exponent 1 (dP) is a *: Help           
Enter CRT exponent 1 (dP)*:
dP = d mod (p-1)
Help
 
CRT exponent 2 (dQ) is a *: Help           
Enter CRT exponent 2 (exp2)*:
dQ = d mod (q-1)
Help
 
CRT coefficient (qInv) is a *: Help           
Enter CRT coefficient (qInv)*:
qInv = q-1 mod p
Help

 
Step 4: Enter plaintext
 
Enter plaintext *: Help
 
Convert plaintext to encoding scheme: Help
Message (m): Help
 
     

 
Step 5: Encrypt message m with public key
 
Ciphertext is a: Help
Ciphertext (c):
c = me mod n
Help
 
       seconds



 
Step 6: Decrypt ciphertext c with private key
 
Message (m): Help
 
Plaintext: Help
 
m = cd mod n Help      seconds
 
m_1 = cdP mod p
m_2 = cdQ mod q
h = (qInv * (m_1 - m_2)) mod p
m= m_2 + q * h

where: p > q
Help      seconds
 

 
Step 7: [Optional] Create an overview of all entered and generated data
 
* = required  
 


Output online RSA key generation: