Skip to main content

Extract The Modulus From Your Private Key

  • Extract public key from the private key file:

To generate a MODULUS, first you need to extract the public key from your RSA private key:

openssl rsa -in <file_name_key>.key -outform PEM -pubout -out <file_name_public>.pub
info

Note: EX00000298 is used for the filename during public key extraction for illustration purpose only.

[user@fedora ~]$ openssl rsa -in EX00000298.key -outform PEM -pubout -out EX00000298.pub
  • Sample of Public Key
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2gqXrJVqeKiW5Awn35Y0
ib3ZaewHBkLclfdEfN8fd3vPHDwN5gC8DbBm6ZmrXGKjNtzwAd8IK7EVZ4uCqx3b
SbkGAAu9WidnFWVt5phYK7c0R0UpkT2nDOTsjO8GQOWc67SyWrXWjWrWdUzHYn7w
2ODsLqq1EL2h2ILlL47Hdo2ppZ5MXXKFIO6m5Ycy5IwIbMPGL8+D1YtVR6un387l
CqZZ7XLJOViQniZwtKfWBE6cnXO8YBaQKruhLxsEtwtgkt5Juil37IJCWKi4ZB3/
Scjk8cWXIG5E0i1JoLWyNPe0xCWPM0xH2RAJBiMdREqX1kst+3GIhEaDO4hiZU2G
9QIDAQAB
-----END PUBLIC KEY-----
  • Extract modulus from the public key

The modulus is in the public key and you can get them using the following command:

openssl rsa -pubin -in <file_name_public>.pub -text -noout
[user@fedora ~]$ openssl rsa -pubin -in EX00000298.pub -text -noout
Public Key: (2048 bit)
Modulus:
00:da:0a:97:ac:95:6a:78:a8:96:e4:0c:27:df:96:
34:89:bd:d9:69:ec:07:06:42:dc:95:f7:44:7c:df:
1f:77:7b:cf:1c:3c:0d:e6:00:bc:0d:b0:66:e9:99:
ab:5c:62:a3:36:dc:f0:01:df:08:2b:b1:15:67:8b:
82:ab:1d:db:49:b9:06:00:0b:bd:5a:27:67:15:65:
6d:e6:98:58:2b:b7:34:47:45:29:91:3d:a7:0c:e4:
ec:8c:ef:06:40:e5:9c:eb:b4:b2:5a:b5:d6:8d:6a:
d6:75:4c:c7:62:7e:f0:d8:e0:ec:2e:aa:b5:10:bd:
a1:d8:82:e5:2f:8e:c7:76:8d:a9:a5:9e:4c:5d:72:
85:20:ee:a6:e5:87:32:e4:8c:08:6c:c3:c6:2f:cf:
83:d5:8b:55:47:ab:a7:df:ce:e5:0a:a6:59:ed:72:
c9:39:58:90:9e:26:70:b4:a7:d6:04:4e:9c:9d:73:
bc:60:16:90:2a:bb:a1:2f:1b:04:b7:0b:60:92:de:
49:ba:29:77:ec:82:42:58:a8:b8:64:1d:ff:49:c8:
e4:f1:c5:97:20:6e:44:d2:2d:49:a0:b5:b2:34:f7:
b4:c4:25:8f:33:4c:47:d9:10:09:06:23:1d:44:4a:
97:d6:4b:2d:fb:71:88:84:46:83:3b:88:62:65:4d:
86:f5
Exponent: 65537 (0x10001)