OpenSSL "ans1parse" - Configuration File for RSA Private Key

Q

Can I build an RSA private key from an OpenSSL configuration file?

✍: FYIcenter.com

A

Yes, you can build an RSA private key from an OpenSSL configuration file, if you know the components of the key, as shown in the test below:

C:\Users\fyicenter>type asn1_rsa_pri_key.cnf
asn1 = SEQUENCE:rsa_pri_key

[rsa_pri_key]
version=INTEGER:0
n      =INTEGER:0xBB6FE79432CC6EA2D8F970675A5A87BFBE1AFF0BE63E879F2AFFB9\
3644D4D2C6D000430DEC66ABF47829E74B8C5108623A1C0EE8BE217B3AD8D36D5EB4FCA1D9
e      =INTEGER:0x010001
d      =INTEGER:0x6F05EAD2F27FFAEC84BEC360C4B928FD5F3A9865D0FCAAD291E2A5\
2F4AF810DC6373278C006A0ABBA27DC8C63BF97F7E666E27C5284D7D3B1FFFE16B7A87B51D
p      =INTEGER:0xF3929B9435608F8A22C208D86795271D54EBDFB09DDEF539AB083D\
A912D4BD57
q      =INTEGER:0xC50016F89DFF2561347ED1186A46E150E28BF2D0F539A1594BBD7F\
E46746EC4F
exp1   =INTEGER:0x9E7D4326C924AFC1DEA40B45650134966D6F9DFA3A7F9D698CD4AB\
EA9C0A39B9
exp2   =INTEGER:0xBA84003BB95355AFB7C50DF140C60513D0BA51D637272E355E3977\
79E7B2458F
coeff  =INTEGER:0x30B9E4F2AFA5AC679F920FC83F1F2DF1BAF1779CF989447FABC2F5\
628657053A

C:\Users\fyicenter>\local\openssl\openssl asn1parse -genc
onf asn1_rsa_pri_key.cnf -noout -out rsa_pri_key.der

C:\Users\fyicenter>\local\openssl\openssl 
   pkey -in rsa_pri_key.der -inform DER -text -noout
Private-Key: (512 bit)
modulus:
    00:bb:6f:e7:94:32:cc:6e:a2:d8:f9:70:67:5a:5a:
    87:bf:be:1a:ff:0b:e6:3e:87:9f:2a:ff:b9:36:44:
    d4:d2:c6:d0:00:43:0d:ec:66:ab:f4:78:29:e7:4b:
    8c:51:08:62:3a:1c:0e:e8:be:21:7b:3a:d8:d3:6d:
    5e:b4:fc:a1:d9
publicExponent: 65537 (0x10001)
privateExponent:
    6f:05:ea:d2:f2:7f:fa:ec:84:be:c3:60:c4:b9:28:
    fd:5f:3a:98:65:d0:fc:aa:d2:91:e2:a5:2f:4a:f8:
    10:dc:63:73:27:8c:00:6a:0a:bb:a2:7d:c8:c6:3b:
    f9:7f:7e:66:6e:27:c5:28:4d:7d:3b:1f:ff:e1:6b:
    7a:87:b5:1d
prime1:
    00:f3:92:9b:94:35:60:8f:8a:22:c2:08:d8:67:95:
    27:1d:54:eb:df:b0:9d:de:f5:39:ab:08:3d:a9:12:
    d4:bd:57
prime2:
    00:c5:00:16:f8:9d:ff:25:61:34:7e:d1:18:6a:46:
    e1:50:e2:8b:f2:d0:f5:39:a1:59:4b:bd:7f:e4:67:
    46:ec:4f
exponent1:
    00:9e:7d:43:26:c9:24:af:c1:de:a4:0b:45:65:01:
    34:96:6d:6f:9d:fa:3a:7f:9d:69:8c:d4:ab:ea:9c:
    0a:39:b9
exponent2:
    00:ba:84:00:3b:b9:53:55:af:b7:c5:0d:f1:40:c6:
    05:13:d0:ba:51:d6:37:27:2e:35:5e:39:77:79:e7:
    b2:45:8f
coefficient:
    30:b9:e4:f2:af:a5:ac:67:9f:92:0f:c8:3f:1f:2d:
    f1:ba:f1:77:9c:f9:89:44:7f:ab:c2:f5:62:86:57:
    05:3a

 

OpenSSL "ans1parse" - RSA Public Key in ASN.1 Structure

OpenSSL "ans1parse" - RSA Private Key in ASN.1 Structure

OpenSSL "ans1parse" Command

⇑⇑ OpenSSL Tutorials

2016-09-27, 6543🔥, 0💬