rsa 公钥和私钥以及一些加密方法

通过windows里面证书属性看到的证书的内容为,这个证书的内容是直接再pc导出的东西,直接导出公钥信息

3082010a
0282010100b5274d659a3614437ec686f0f4438f85d02fcd6548f6ade4ce0c0f7c57b9c6ff2677b3b349db88f16b8fd73132fcd6a370dbda0490323b0a9d81d802d226133790800a1e7c4b5e61b481a6b6790f0a179c2435beab5572bfef0ff477c8cc46488b18cafc47b5cc4164156ccd2b320101b6b6f19e6909e125204fce9d2c72895e463c5c604a1699b7f02420a2159ee6f5a8275ee42cc90abc18d21f502ce8b30bc3eb9281b5f20c0ec8264022a258a27c2dd0ac73c934f7d860f7149889b009ba72276c3c86750169f040e4a4a242a52967a95c9f8ee19286f184b87d352c080fb0c1713aa4b1c93f42c6038fc2ae6c48926895daf93668199de5e3d4cf4f49dd
0203010001

公钥的模是2048的数据长度,这个数据的长度为2048个bit的数据长度信息,根据2048/8=256个字节的长度。导出的内容为n和e的数据内容。

java代码里面的类PublicKey,这个类的作用是的数据格式不太一样。

300D06092A864886F70D0101010500这一串的数据内容不知道是什么东西

标签是30开头,长度是0d,数据内容是干什么用的。

30820122

300D06092A864886F70D0101010500

0382010F003082010A0282010100B5274D659A3614437EC686F0F4438F85D02FCD6548F6ADE4CE0C0F7C57B9C6FF2677B3B349DB88F16B8FD73132FCD6A370DBDA0490323B0A9D81D802D226133790800A1E7C4B5E61B481A6B6790F0A179C2435BEAB5572BFEF0FF477C8CC46488B18CAFC47B5CC4164156CCD2B320101B6B6F19E6909E125204FCE9D2C72895E463C5C604A1699B7F02420A2159EE6F5A8275EE42CC90ABC18D21F502CE8B30BC3EB9281B5F20C0EC8264022A258A27C2DD0AC73C934F7D860F7149889B009BA72276C3C86750169F040E4A4A242A52967A95C9F8EE19286F184B87D352C080FB0C1713AA4B1C93F42C6038FC2AE6C48926895DAF93668199DE5E3D4CF4F49DD0203010001

那么如何通过公钥生成x509证书呢?或者通过私钥生成pkcs8格式的数据内容?这个数据确实比较麻烦的东西

x509证书格式内容:整个证书的内容会分三段信息进行区分,都是以30开头的数据,包含了三个数据段,另外可以使用的tag就是02,公钥和私钥都是使用02为开头的标签

308203cf
308202b7
a00302010202104f433d5c1c0f60ad40d46d82280204bb300d06092a864886f70d01010b05003067312b3029060355040b0c224372656174656420627920687474703a2f2f7777772e666964646c6572322e636f6d31153013060355040a0c0c444f5f4e4f545f54525553543121301f06035504030c18444f5f4e4f545f54525553545f466964646c6572526f6f74301e170d3135313130353232303131315a170d3231313130343232303131315a305c312b3029060355040b0c224372656174656420627920687474703a2f2f7777772e666964646c6572322e636f6d31153013060355040a0c0c444f5f4e4f545f54525553543116301406035504030c0d2a2e3131322e326f372e6e657430820122300d06092a864886f70d01010105000382010f003082010a0282010100b5274d659a3614437ec686f0f4438f85d02fcd6548f6ade4ce0c0f7c57b9c6ff2677b3b349db88f16b8fd73132fcd6a370dbda0490323b0a9d81d802d226133790800a1e7c4b5e61b481a6b6790f0a179c2435beab5572bfef0ff477c8cc46488b18cafc47b5cc4164156ccd2b320101b6b6f19e6909e125204fce9d2c72895e463c5c604a1699b7f02420a2159ee6f5a8275ee42cc90abc18d21f502ce8b30bc3eb9281b5f20c0ec8264022a258a27c2dd0ac73c934f7d860f7149889b009ba72276c3c86750169f040e4a4a242a52967a95c9f8ee19286f184b87d352c080fb0c1713aa4b1c93f42c6038fc2ae6c48926895daf93668199de5e3d4cf4f49dd0203010001a38181307f300e0603551d0f0101ff0404030204b030130603551d25040c300a06082b0601050507030130180603551d110411300f820d2a2e3131322e326f372e6e6574301f0603551d23041830168014b5b51929581bf24ebf051019c37dc41be944f215301d0603551d0e041604145154d59ca2556ca5ca477a0a4a539440d40c5f03

300d06092a864886f70d01010b0500

03820101
007fcb19ece2744c6c068abd0271c84922f7143d2b8cecc6c08ce09acb7a0e5c54e18ba8aa90254e1460c955aec98f6ea54057d5e3e75f272e6c1fb1fbbe9dabdbf13ea66ec2b49114ecdf234706feb8dfb21109ee7b6083ceaf3d38b89b9951e6340272c76326094d13e94fe9e0542c7522e72d11626c1aa9159560f05e31e2f1eb6615592c4aa59cb937aef51288d8609b8b15824cad5321365da84d0f4497e0170521b93e42374b6b0f2ffcb78c60e06ef6bc32b3445a06a3faf69f925aff5fbf31601501d438b313a332b1248c090ed7ad8f8af05f1ac0ed5d3eafcd7e9b03885aa90c1ed4fc6f6d5227ea12724350b8e59b7ca80a5ff3f6b734ca8763860e

 

posted on 2018-07-10 12:47  tistar  阅读(4437)  评论(0编辑  收藏  举报