当前所在位置:首页 > 关于我们 > 资讯中心

PEM格式RSA密钥解析(二)

发布时间:2023-02-03

上一部分讲解了将Base64编码的密钥数据转换成hex格式数据,本章将介绍如何获从转码后的数据中获取RSA密钥的相关参数。

根据 RSA 密钥语法中的结构对私钥解析结果如下:



图-1
上一节转码后的私钥为:

3082025B0201000281807538085EB2BEA6F95818707187EF87FA37369C1C48995C7E3D2721978A1CB62F24E220CE457A7884CBA1B9756D771DED6

BEF4B301F4571E8B333AA614ED487DDD82ABA9D3BD32B9B1DDE1B4C9E6361AD5D45B4B8D30594052C730CC4E6C268253E90C116B4FFBFC0AA

540166122C0434ACFF0EF55EAB5AA3C2E0EBFC313AC7A10203010001028180651CD47B7B8C61D42C5DC880E65584E21DC6899B0C34DE4836D00E75FDB

90E9E541E8B55E330E5CD072A9623E92D1B2FB62F50984E214545096FC3C4F48EF832FB7ADB7A5BEC1F3041D4F2AECA729E692EF0D906D634C2E8FBF99C1371D

08BAD028E0AC7899EE44BE2C6BF33ADB08066EE88FAAD8FD893D101A921C519C4D891024100E2E38FA005D7E086F6475F91ABB1644C398636EE19BFB284E16B9C

1804210733C45F3A51BDB033357B7DA3BAAD17CE1D78DDA9C69613158DB962B3541E0281E302410084423A45814E139CF1B6A10CD108A4399C0CB11BF78363C

439692E5B465892BFAC3EE8084F8CA33A3CC13C87583C4E2F30DED2780AB32B8E8A58010E4194F7AB024062DE22A1EAA9ED6F22366BD0C06E667448C4D17EE3BD

82FF207391EB6D312F40419BF57FD516C8D9CF5C2A529846BD4C5E74C91C7E1D06D1612D3F53B258095D02404F83A596EDF36BD53A78EB005298186BCE46CF201A41B

2F460F3BC7C01A1F4B029B53438F2E281ABDCA4EC680E834B1A120E9488B91E18FCBC6DC64CB4DF03BB024100B3FEB058F79C80A6D24B1FBE3E5C36819EB5366E053B5094

EE00ED87431559DCA7ECAFF5987095AEA451E143F843DE104AC0E654AB22C4861770B604076E9CF5

结合上面的私钥,解析后如下:
n: 7538085EB2BEA6F95818707187EF87FA37369C1C48995C7E3D2721978A1CB62F24E220CE457A7 884CBA1B9756D771DED6BEF4B301F4571E8B333AA614ED487DDD82ABA9D3BD32B9B1DDE1B4 C9E6361AD5D45B4B8D30594052C730CC4E6C268253E90C116B4FFBFC0AA540166122C0434ACF F0EF55EAB5AA3C2E0EBFC313AC7A1
e: 010001
d:651CD47B7B8C61D42C5DC880E65584E21DC6899B0C34DE4836D00E75FDB90E9E541E8B55E330 E5CD072A9623E92D1B2FB62F50984E214545096FC3C4F48EF832FB7ADB7A5BEC1F3041D4F2AEC A729E692EF0D906D634C2E8FBF99C1371D08BAD028E0AC7899EE44BE2C6BF33ADB08066EE88F AAD8FD893D101A921C519C4D891
P: (参数前多一个字节 00)00E2E38FA005D7E086F6475F91ABB1644C398636EE19BFB284E16B9C1804210733C45F3A51BDB 033357B7DA3BAAD17CE1D78DDA9C69613158DB962B3541E0281E3
q:(参数前多一个字节 00) 0084423A45814E139CF1B6A10CD108A4399C0CB11BF78363C439692E5B465892BFAC3EE8084F8 CA33A3CC13C87583C4E2F30DED2780AB32B8E8A58010E4194F7AB
dp: 62DE22A1EAA9ED6F22366BD0C06E667448C4D17EE3BD82FF207391EB6D312F40419BF57FD516 C8D9CF5C2A529846BD4C5E74C91C7E1D06D1612D3F53B258095D
dq: 4F83A596EDF36BD53A78EB005298186BCE46CF201A41B2F460F3BC7C01A1F4B029B53438F2E28 1ABDCA4EC680E834B1A120E9488B91E18FCBC6DC64CB4DF03BB
Qinv: (参数前多一个字节 00)
00B3FEB058F79C80A6D24B1FBE3E5C36819EB5366E053B5094EE00ED87431559DCA7ECAFF5987 095AEA451E143F843DE104AC0E654AB22C4861770B604076E9CF5
上一节转码后的公钥为:

30819E300D06092A864886F70D010101050003818C003081880281807538085EB2BEA6F95818707187EF87FA37369C1C48995C7E3D2721978A1CB62F24E220CE457A

7884CBA1B9756D771DED6BEF4B301F4571E8B333AA614ED487DDD82ABA9D3BD32B9B1DDE1B4C9E6361AD5D45B4B8D30594052C730CC4E6C268253E90C116B4FFBF

C0AA540166122C0434ACFF0EF55EAB5AA3C2E0 EBFC313AC7A10203010001

根据 RSA 密钥语法中的结构对公钥解析结果如下:



图-2

n:7538085EB2BEA6F95818707187EF87FA37369C1C48995C7E3D2721978A1CB62F24E220CE457A7884CBA1B9756D771DED6BEF4B301F4571E8B333AA614ED487DDD82ABA9D3BD32B9B1DD

E1B4C9E6361AD5D45B4B8D30594052C730CC4E6C268253E90C116B4FFBFC0AA540166122C0434ACFF0EF55EAB5AA3C2E0EBFC313AC7A1

e: 010001
上一篇:LKT(LCS)安全芯片RSA密钥存储格式说明 下一篇:恭贺新春