裸公钥和x509格式公钥的区别 (公钥,非证书)
x509 = 30820122300D06092A864886F70D01010105000382010F003082010A02820101||00 || 256字节的modulus||0203010001
解析:
0203010001 tag length value 结构 ,pubExponent= 010001
大于7F补 00 ?
30820122300D06092A864886F70D01010105000382010F003082010A02820101:
30 820122
30 0D
06 09
2A864886F70D010101 0500
03 82010F
00 30 82010A
02 820101
-------
2048 / 8 = 256 , 补00后 257 字节 , 16进制表示 0101
0500 公钥参数 (tag 05 ,len 00 ),ECC才有公钥参数,RSA为null
RSA 2048公钥OID:
OID description for 1.2.840.113549.1.1.1 - RSA encryption
转换成hex : 2A864886F70D010101
示例:
pubEncoded = 30820122300D06092A864886F70D01010105000382010F003082010A0282010100BDDD328C24A29A904594D7471B7243324E09F4953A3AC1CC42BC60803B956875720C3E1EC5181E27FE2B5E9CB117A08319F2790308820C079BAECBCA931A782F9E796315108325140009C577D4EA6CFC9AE975C1554BF957555C72412DD0983FD940E75039F15F346E9C95EC1297932E037BF31CB2424294FF78366A68C5597AEC2C6986F3CE90AFDCC24B8FC344939C57E24D3601ABA724B3BBE4D6F21B8C12CA8B32941843C93FA839E8663FDDF1F68D7FBA80D43F86A2C085210DB293CE0275745FF6976114F4EA8D3FCF788C267582B3CD4AED69B8F2490B8F0EB61D2C33661ECED6D08F439A56DC23CA4BECBA5C5962EB452669CD1C81EA6330704CE0770203010001
pubModulus = 00BDDD328C24A29A904594D7471B7243324E09F4953A3AC1CC42BC60803B956875720C3E1EC5181E27FE2B5E9CB117A08319F2790308820C079BAECBCA931A782F9E796315108325140009C577D4EA6CFC9AE975C1554BF957555C72412DD0983FD940E75039F15F346E9C95EC1297932E037BF31CB2424294FF78366A68C5597AEC2C6986F3CE90AFDCC24B8FC344939C57E24D3601ABA724B3BBE4D6F21B8C12CA8B32941843C93FA839E8663FDDF1F68D7FBA80D43F86A2C085210DB293CE0275745FF6976114F4EA8D3FCF788C267582B3CD4AED69B8F2490B8F0EB61D2C33661ECED6D08F439A56DC23CA4BECBA5C5962EB452669CD1C81EA6330704CE077
pubExponent= 010001
==============
如果生成 后面那个 0500