公钥证书采用的是X509证书:
openssl asn1parse -in rsa_public_key.pem -strparse 18
0:d=0 hl=3 l= 137 cons: SEQUENCE
3:d=1 hl=3 l= 129 prim: INTEGER :CDF9E1C4973CBDA66644BB259F7FFB43AF0DC86F440400EB6ACF5734B1350D758DF78091BCA7BCEB30E8D8D47CADA0FACBD0BF13250C5110E49CF39B32642ECDA5B222D282A197DE1DED09749FC638617D8DF15179D935CAECBD9D38C6C5FF1E4EFDBBC6D69C28B69C19E4FA325A98C3B90863AFD7251438C93F12473C8FF94B
135:d=1 hl=2 l= 3 prim: INTEGER :010001
30 81 9F //30代表的是sequence数据段属性
30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00
03 81 8D 00//03代表是bit string数据字段
30 81 89
02 81 81 //81表示长度域为1个字节,长度为0x81,代表的是n
00 CD F9 E1 C4 97 3C BD A6 66 44 BB 25 9F 7F
FB 43 AF 0D C8 6F 44 04 00 EB 6A CF 57 34 B1
35 0D 75 8D F7 80 91 BC A7 BC EB 30 E8 D8 D4
7C AD A0 FA CB D0 BF 13 25 0C 51 10 E4 9C F3
9B 32 64 2E CD A5 B2 22 D2 82 A1 97 DE 1D ED
09 74 9F C6 38 61 7D 8D F1 51 79 D9 35 CA EC
BD 9D 38 C6 C5 FF 1E 4E FD BB C6 D6 9C 28 B6
9C 19 E4 FA 32 5A 98 C3 B9 08 63 AF D7 25 14
38 C9 3F 12 47 3C 8F F9 4B
02 03 01 00 01//直接用长度表示,03表示有3个字节,02代表的是整值数据类型,010001数据代表的是e值
长度说明:如果长度小于127,那么用一个字节表示,如果长度大于127,大于01111111,后续字节第一位为1表示长度域有几个字节
一般情况,公钥证书采用的是509的格式,但是私钥证书采用的格式不一样,一般采用的是pcks1的格式,
私钥证书:
30 82 02 5D 02 01 00 02 81 81 00 CD F9 E1 C4 97 3C BD A6 66 44 BB 25 9F 7F FB 43 AF 0D C8 6F 44 04 00 EB 6A CF 57 34 B1 35 0D 75 8D F7 80 91 BC A7 BC EB 30 E8 D8 D4 7C AD A0 FA CB D0 BF 13 25 0C 51 10 E4 9C F3 9B 32 64 2E CD A5 B2 22 D2 82 A1 97 DE 1D ED 09 74 9F C6 38 61 7D 8D F1 51 79 D9 35 CA EC BD 9D 38 C6 C5 FF 1E 4E FD BB C6 D6 9C 28 B6 9C 19 E4 FA 32 5A 98 C3 B9 08 63 AF D7 25 14 38 C9 3F 12 47 3C 8F F9 4B 02 03 01 00 01 02 81 80 67 D0 F2 C2 2B 98 29 DE 9C DD 37 96 96 F5 E2 A7 12 AC 57 C1 FC FE 27 98 80 95 50 D6 F6 1A 4F 56 58 DF CE A5 A5 F8 C5 77 A5 87 37 02 A2 74 C1 16 A7 73 E7 5A B6 E9 A6 52 65 67 D6 40 FA FD 13 B9 1B AA 29 22 0A 6F F8 B6 27 4B 3E 24 51 F5 CA 44 D8 E4 87 D2 77 B7 5E 91 7F 4A B6 4D 1A 11 68 8E 4F DF 24 F2 A7 8A 68 20 51 AA B6 9D A9 A6 8E 6D B9 40 ED 0D 28 7A 72 66 B2 01 44 42 4C 66 C4 C1 02 41 00 EA A4 3E EA 83 AB 11 12 15 DC 50 04 6A E2 AC 65 50 4F 81 39 AC C7 08 DA DD E2 29 AE 98 12 1A C8 DE 8C 0F C2 39 FC 6D BF B5 13 D5 CF 10 98 78 8B 42 A7 B6 BE 99 00 10 65 28 05 83 AD 49 6C 2B 7F 02 41 00 E0 B9 A8 0B 0F 80 64 27 3B F2 EC 08 BA 1C 8D F2 DA 27 0E E2 4C 58 00 5A 48 0D 12 03 B3 55 52 23 86 89 31 DC F5 6E 71 49 69 43 60 23 61 36 CF 66 97 DE 4D 3A 7C 06 2D AB 0C 1D 2C 9C EB B1 08 35 02 41 00 98 77 7B 6E 75 7A 3E 10 6B 66 0A 14 A4 C3 7F D4 21 78 57 F6 FB 1F 25 D0 DA 26 F0 80 C3 CD D7 DB B8 48 78 A0 F3 7E E4 6D 92 A3 3D E6 5B D9 47 52 EE 4F FE 7E 20 FB 1A AC 30 72 4C DA D7 FF D2 CF 02 41 00 B4 01 22 70 91 9F 27 1A 22 33 E8 0A E9 80 DB D6 EE 15 21 1F F5 44 FC 2B 54 D1 5B 5F A9 73 2B 53 17 7D A7 7A 35 01 9D 2E CF 69 4F 85 A7 65 EE E5 5F BA 8A 23 D1 9A 65 54 40 64 D2 0A 73 E4 1F 0D 02 40 15 2D C4 B7 94 89 04 CB CD 28 D4 F9 96 AD 22 E2 78 A4 85 40 39 C5 E5 43 3D 3B 48 00 12 5D 49 FF 3C C1 56 63 C8 43 37 F0 71 59 ED 60 E3 E6 A8 09 4B 16 89 2F 60 46 B4 68 89 3D 43 54 BF 9E 0D 33
使用命令查询的结果为:
Private-Key: (1024 bit)
modulus:
00:cd:f9:e1:c4:97:3c:bd:a6:66:44:bb:25:9f:7f:
fb:43:af:0d:c8:6f:44:04:00:eb:6a:cf:57:34:b1:
35:0d:75:8d:f7:80:91:bc:a7:bc:eb:30:e8:d8:d4:
7c:ad:a0:fa:cb:d0:bf:13:25:0c:51:10:e4:9c:f3:
9b:32:64:2e:cd:a5:b2:22:d2:82:a1:97:de:1d:ed:
09:74:9f:c6:38:61:7d:8d:f1:51:79:d9:35:ca:ec:
bd:9d:38:c6:c5:ff:1e:4e:fd:bb:c6:d6:9c:28:b6:
9c:19:e4:fa:32:5a:98:c3:b9:08:63:af:d7:25:14:
38:c9:3f:12:47:3c:8f:f9:4b
publicExponent: 65537 (0x10001)
privateExponent:
67:d0:f2:c2:2b:98:29:de:9c:dd:37:96:96:f5:e2:
a7:12:ac:57:c1:fc:fe:27:98:80:95:50:d6:f6:1a:
4f:56:58:df:ce:a5:a5:f8:c5:77:a5:87:37:02:a2:
74:c1:16:a7:73:e7:5a:b6:e9:a6:52:65:67:d6:40:
fa:fd:13:b9:1b:aa:29:22:0a:6f:f8:b6:27:4b:3e:
24:51:f5:ca:44:d8:e4:87:d2:77:b7:5e:91:7f:4a:
b6:4d:1a:11:68:8e:4f:df:24:f2:a7:8a:68:20:51:
aa:b6:9d:a9:a6:8e:6d:b9:40:ed:0d:28:7a:72:66:
b2:01:44:42:4c:66:c4:c1
prime1:
00:ea:a4:3e:ea:83:ab:11:12:15:dc:50:04:6a:e2:
ac:65:50:4f:81:39:ac:c7:08:da:dd:e2:29:ae:98:
12:1a:c8:de:8c:0f:c2:39:fc:6d:bf:b5:13:d5:cf:
10:98:78:8b:42:a7:b6:be:99:00:10:65:28:05:83:
ad:49:6c:2b:7f
prime2:
00:e0:b9:a8:0b:0f:80:64:27:3b:f2:ec:08:ba:1c:
8d:f2:da:27:0e:e2:4c:58:00:5a:48:0d:12:03:b3:
55:52:23:86:89:31:dc:f5:6e:71:49:69:43:60:23:
61:36:cf:66:97:de:4d:3a:7c:06:2d:ab:0c:1d:2c:
9c:eb:b1:08:35
exponent1:
00:98:77:7b:6e:75:7a:3e:10:6b:66:0a:14:a4:c3:
7f:d4:21:78:57:f6:fb:1f:25:d0:da:26:f0:80:c3:
cd:d7:db:b8:48:78:a0:f3:7e:e4:6d:92:a3:3d:e6:
5b:d9:47:52:ee:4f:fe:7e:20:fb:1a:ac:30:72:4c:
da:d7:ff:d2:cf
exponent2:
00:b4:01:22:70:91:9f:27:1a:22:33:e8:0a:e9:80:
db:d6:ee:15:21:1f:f5:44:fc:2b:54:d1:5b:5f:a9:
73:2b:53:17:7d:a7:7a:35:01:9d:2e:cf:69:4f:85:
a7:65:ee:e5:5f:ba:8a:23:d1:9a:65:54:40:64:d2:
0a:73:e4:1f:0d
coefficient:
15:2d:c4:b7:94:89:04:cb:cd:28:d4:f9:96:ad:22:
e2:78:a4:85:40:39:c5:e5:43:3d:3b:48:00:12:5d:
49:ff:3c:c1:56:63:c8:43:37:f0:71:59:ed:60:e3:
e6:a8:09:4b:16:89:2f:60:46:b4:68:89:3d:43:54:
bf:9e:0d:33
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDN+eHElzy9pmZEuyWff/tDrw3Ib0QEAOtqz1c0sTUNdY33gJG8
p7zrMOjY1HytoPrL0L8TJQxREOSc85syZC7NpbIi0oKhl94d7Ql0n8Y4YX2N8VF5
2TXK7L2dOMbF/x5O/bvG1pwotpwZ5PoyWpjDuQhjr9clFDjJPxJHPI/5SwIDAQAB
AoGAZ9DywiuYKd6c3TeWlvXipxKsV8H8/ieYgJVQ1vYaT1ZY386lpfjFd6WHNwKi
dMEWp3PnWrbpplJlZ9ZA+v0TuRuqKSIKb/i2J0s+JFH1ykTY5IfSd7dekX9Ktk0a
EWiOT98k8qeKaCBRqradqaaObblA7Q0oenJmsgFEQkxmxMECQQDqpD7qg6sREhXc
UARq4qxlUE+BOazHCNrd4imumBIayN6MD8I5/G2/tRPVzxCYeItCp7a+mQAQZSgF
g61JbCt/AkEA4LmoCw+AZCc78uwIuhyN8tonDuJMWABaSA0SA7NVUiOGiTHc9W5x
SWlDYCNhNs9ml95NOnwGLasMHSyc67EINQJBAJh3e251ej4Qa2YKFKTDf9QheFf2
+x8l0Nom8IDDzdfbuEh4oPN+5G2Soz3mW9lHUu5P/n4g+xqsMHJM2tf/0s8CQQC0
ASJwkZ8nGiIz6ArpgNvW7hUhH/VE/CtU0VtfqXMrUxd9p3o1AZ0uz2lPhadl7uVf
uooj0ZplVEBk0gpz5B8NAkAVLcS3lIkEy80o1PmWrSLieKSFQDnF5UM9O0gAEl1J
/zzBVmPIQzfwcVntYOPmqAlLFokvYEa0aIk9Q1S/ng0z
-----END RSA PRIVATE KEY-----
30 82 02 5D
02 01 00
02 81 81 00 CD F9 E1 C4 97 3C BD A6 66 44 BB 25 9F 7F FB 43 AF 0D C8 6F 44 04 00 EB 6A CF 57 34 B1 35 0D 75 8D F7 80 91 BC A7 BC EB 30 E8 D8 D4 7C AD A0 FA CB D0 BF 13 25 0C 51 10 E4 9C F3 9B 32 64 2E CD A5 B2 22 D2 82 A1 97 DE 1D ED 09 74 9F C6 38 61 7D 8D F1 51 79 D9 35 CA EC BD 9D 38 C6 C5 FF 1E 4E FD BB C6 D6 9C 28 B6 9C 19 E4 FA 32 5A 98 C3 B9 08 63 AF D7 25 14 38 C9 3F 12 47 3C 8F F9 4B
02 03 01 00 01
02 81 80 67 D0 F2 C2 2B 98 29 DE 9C DD 37 96 96 F5 E2 A7 12 AC 57 C1 FC FE 27 98 80 95 50 D6 F6 1A 4F 56 58 DF CE A5 A5 F8 C5 77 A5 87 37 02 A2 74 C1 16 A7 73 E7 5A B6 E9 A6 52 65 67 D6 40 FA FD 13 B9 1B AA 29 22 0A 6F F8 B6 27 4B 3E 24 51 F5 CA 44 D8 E4 87 D2 77 B7 5E 91 7F 4A B6 4D 1A 11 68 8E 4F DF 24 F2 A7 8A 68 20 51 AA B6 9D A9 A6 8E 6D B9 40 ED 0D 28 7A 72 66 B2 01 44 42 4C 66 C4 C1
02 41 00 EA A4 3E EA 83 AB 11 12 15 DC 50 04 6A E2 AC 65 50 4F 81 39 AC C7 08 DA DD E2 29 AE 98 12 1A C8 DE 8C 0F C2 39 FC 6D BF B5 13 D5 CF 10 98 78 8B 42 A7 B6 BE 99 00 10 65 28 05 83 AD 49 6C 2B 7F
02 41 00 E0 B9 A8 0B 0F 80 64 27 3B F2 EC 08 BA 1C 8D F2 DA 27 0E E2 4C 58 00 5A 48 0D 12 03 B3 55 52 23 86 89 31 DC F5 6E 71 49 69 43 60 23 61 36 CF 66 97 DE 4D 3A 7C 06 2D AB 0C 1D 2C 9C EB B1 08 35
02 41 00 98 77 7B 6E 75 7A 3E 10 6B 66 0A 14 A4 C3 7F D4 21 78 57 F6 FB 1F 25 D0 DA 26 F0 80 C3 CD D7 DB B8 48 78 A0 F3 7E E4 6D 92 A3 3D E6 5B D9 47 52 EE 4F FE 7E 20 FB 1A AC 30 72 4C DA D7 FF D2 CF
02 41 00 B4 01 22 70 91 9F 27 1A 22 33 E8 0A E9 80 DB D6 EE 15 21 1F F5 44 FC 2B 54 D1 5B 5F A9 73 2B 53 17 7D A7 7A 35 01 9D 2E CF 69 4F 85 A7 65 EE E5 5F BA 8A 23 D1 9A 65 54 40 64 D2 0A 73 E4 1F 0D
02 40 15 2D C4 B7 94 89 04 CB CD 28 D4 F9 96 AD 22 E2 78 A4 85 40 39 C5 E5 43 3D 3B 48 00 12 5D 49 FF 3C C1 56 63 C8 43 37 F0 71 59 ED 60 E3 E6 A8 09 4B 16 89 2F 60 46 B4 68 89 3D 43 54 BF 9E 0D 33
从数据可以看到,数据字段的内容都是以02开头,代表的就是整形数据内容,接着就是长度内容,整个数据内容是按着一定的格式进行排列的;一定的数据格式进行排列,必须按一定顺序进行排列的,并且没有公钥一样的情况,没有进行包括的嵌套格式内容;私钥证书里面包含的有公钥证书内容,证书包含的内容为:n,e,d,p,q,dp,dp,qinv共8项数据