"); //-->
Base64转16进制格式
后缀是.PEM 的数字证书是 BASE64 编码的,以 ASCII 码来表示。常见的证书如下所示(以
RSA1024 为例):
私钥:
----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgHU4CF6yvqb5WBhwcYfvh/o3NpwcSJlcfj0nIZeKHLYvJOIgzkV6eITLobl1bXcd7Wvv
SzAfRXHoszOqYU7Uh93YKrqdO9Mrmx3eG0yeY2GtXUW0uNMFlAUscwzE5sJoJT6QwRa0/7/AqlQB
ZhIsBDSs/w71Xqtao8Lg6/wxOsehAgMBAAECgYBlHNR7e4xh1CxdyIDmVYTiHcaJmww03kg20A51/
bkOnlQei1XjMOXNByqWI+ktGy+2L1CYTiFFRQlvw8T0jvgy+3rbelvsHzBB1PKuynKeaS7w2QbWNML
o+/mcE3HQi60CjgrHiZ7kS+LGvzOtsIBm7oj6rY/Yk9EBqSHFGcTYkQJBAOLjj6AF1+CG9kdfkauxZEw5h
jbuGb+yhOFrnBgEIQczxF86Ub2wMzV7faO6rRfOHXjdqcaWExWNuWKzVB4CgeMCQQCEQjpFgU4T
nPG2oQzRCKQ5nAyxG/eDY8Q5aS5bRliSv6w+6AhPjKM6PME8h1g8Ti8w3tJ4CrMrjopYAQ5BlPerAk
Bi3iKh6qntbyI2a9DAbmZ0SMTRfuO9gv8gc5HrbTEvQEGb9X/VFsjZz1wqUphGvUxedMkcfh0G0WEt
P1OyWAldAkBPg6WW7fNr1Tp46wBSmBhrzkbPIBpBsvRg87x8AaH0sCm1NDjy4oGr3KTsaA6DSxoS
DpSIuR4Y/Lxtxky03wO7AkEAs/6wWPecgKbSSx++Plw2gZ61Nm4FO1CU7gDth0MVWdyn7K/1mHC
VrqRR4UP4Q94QSsDmVKsixIYXcLYEB26c9Q==
-----END RSA PRIVATE KEY-----
公钥:
-----BEGIN PUBLIC KEY-----
MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgHU4CF6yvqb5WBhwcYfvh/o3NpwcSJlcfj0nIZe
KHLYvJOIgzkV6eITLobl1bXcd7WvvSzAfRXHoszOqYU7Uh93YKrqdO9Mrmx3eG0yeY2GtXUW0uNMF
lAUscwzE5sJoJT6QwRa0/7/AqlQBZhIsBDSs/w71Xqtao8Lg6/wxOsehAgMBAAE=
-----END PUBLIC KEY-----
需要将公私钥进行解析后,以 16 进制数据按要求写入 LKT 芯片。在此需要借助一些转
换工具,解析步骤如下:
BASE64编码转换16进制
如要找出相应的RSA的密钥值需要先将BASE64编码转换成16进制格式数据。
打开 rsa_V3.4 软件(公司内部软件,用户可使用),如图一所示。在“RSA”页面下选择“Tool”,进入图二界面。在上面的文本输入框中拷贝私钥的 Base64 编码,然后点击“Base64—>HEX”按钮,下面的文本框中会显示转换后的 HEX 数据。下图中为私钥的转换,公钥转换类似。
转换后的私钥:
3082025B0201000281807538085EB2BEA6F95818707187EF87FA37369C1C48995C7E3D2721978
A1CB62F24E220CE457A7884CBA1B9756D771DED6BEF4B301F4571E8B333AA614ED487DDD82A
BA9D3BD32B9B1DDE1B4C9E6361AD5D45B4B8D30594052C730CC4E6C268253E90C116B4FFBFC
0AA540166122C0434ACFF0EF55EAB5AA3C2E0EBFC313AC7A10203010001028180651CD47B7B8C61D42C5DC880E65584E21DC6899B0C34DE4836D00E75FDB90E9E541E8B55E330E5CD072A962
3E92D1B2FB62F50984E214545096FC3C4F48EF832FB7ADB7A5BEC1F3041D4F2AECA729E692EF0
D906D634C2E8FBF99C1371D08BAD028E0AC7899EE44BE2C6BF33ADB08066EE88FAAD8FD893D
101A921C519C4D891024100E2E38FA005D7E086F6475F91ABB1644C398636EE19BFB284E16B9C
1804210733C45F3A51BDB033357B7DA3BAAD17CE1D78DDA9C69613158DB962B3541E0281E30
2410084423A45814E139CF1B6A10CD108A4399C0CB11BF78363C439692E5B465892BFAC3EE808
4F8CA33A3CC13C87583C4E2F30DED2780AB32B8E8A58010E4194F7AB024062DE22A1EAA9ED6F
22366BD0C06E667448C4D17EE3BD82FF207391EB6D312F40419BF57FD516C8D9CF5C2A529846
BD4C5E74C91C7E1D06D1612D3F53B258095D02404F83A596EDF36BD53A78EB005298186BCE46
CF201A41B2F460F3BC7C01A1F4B029B53438F2E281ABDCA4EC680E834B1A120E9488B91E18FCB
C6DC64CB4DF03BB024100B3FEB058F79C80A6D24B1FBE3E5C36819EB5366E053B5094EE00ED8
7431559DCA7ECAFF5987095AEA451E143F843DE104AC0E654AB22C4861770B604076E9CF5
转换后的公钥:
30819E 300D06092A864886F70D0101010500 03818C 00308188 0281807538085EB2BEA6F95
818707187EF87FA37369C1C48995C7E3D2721978A1CB62F24E220CE457A7884CBA1B9756D771
DED6BEF4B301F4571E8B333AA614ED487DDD82ABA9D3BD32B9B1DDE1B4C9E6361AD5D45B4B
8D30594052C730CC4E6C268253E90C116B4FFBFC0AA540166122C0434ACFF0EF55EAB5AA3C2E0
EBFC313AC7A10203010001
下一篇将详细讲解如何从转换后的16进制数据中找到对应的RSA公私钥参数。
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。