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----- MIGeMA0GCSqGSIb3DQEBAQUAA4GM ADCBiAKBgHU4CF6yvqb5WBhwcYfvh/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公私鑰參數。
|