PEM(Privacy Enhanced Mail)一般为文本格式,以 “-----BEGIN ***-----”开头,以 “-----END ***-----结尾”,中间的内容是Base64编码。这种格式可以保存证书和私钥,为了区分证书与私钥,一般会将PEM格式的私钥后缀改为.key.
PEM Filename Extensions
PEM files are usually seen with the extensions .crt, .pem, .cer, and .key (for private keys), but you may also see them with different extensions. For example, the SSL.com CA bundle file available from the download table in a certificate order has the extension .ca-bundle
-----BEGIN RSA PRIVATE KEY----- MIICXAIBAAKBgQDJTwCsWHU4MTzHkZOiG2otXsG3kEHPh5C68M7CQf1f+DK/NRD/ pEj9kk98+hx2hQKlAIKHe3JFT6TXNONVeJGMX+8o1i5V7VSFiedmgbFAJdn3Ginv 0xQJuon0WUjymY66bD4c5xEXZWNTDmI2sPcZ0/3NgShBEGmCw6j+7EdQSwIDAQAB AoGAJIjYAG9VZstY0odTGdqL3IwT8DKYHwfldmf5vjuntmEfJKCG4z53mL2S+4WQ 4Nmm7zc2eUwoIvgfXIdWss5c66A3NBUPg1Q3XcWVTvx50pLtcTH9uVPWOYc5ZF68 kJdobmZgsfqrgkBpDSeWkDwih0H5P3SoVlX/6p16PACWy/ECQQD6r96HRIaJrcmS 6K+E5K5+ADgEfn4tiT7tAZ8MCAp84CYgJtCnGTlqc+MCx874UQ8x4SGff5qh0iyo fL8eOsTnAkEAzZM5r7wK+NZCHyJudUUe62QNs1StD5OLXRL+/WyoJRjdwspzkLw6 MD4M+wlBOOl3UN8gaVjc4QwnBp8GBKiI/QJAJ8EmH/ts/n5x3ftKgl+lkFPGjmfk 6KHAOeOs7kKEL0N4qFafdjBY25nfITzAhL6OE1HpfBrHUew7qsiFomyddwJAMZrj Apq3cxAQaH7gdH+3VEmSXMGD+Qw7Rrw8t14uvLThXg2IEVa6G8X9T94N1PPRDLyq j4EX214ZVKmuxBT+6QJBAPqAe2riAeNzYNmy4efed7bktAkZdvEu80mWsJ51BeX4 37xs3pWLoWwZomSgLd+ACl+AaJJS6CgTAyNUlWCbX+M= -----END RSA PRIVATE KEY-----
DER数据
30 82 02 5C 02 01 00 02 81 81 00 C9 4F 00 AC 58 75 38 31 3C C7 91 93 A2 1B 6A 2D 5E C1 B7 90 41 CF 87 90 BA F0 CE C2 41 FD 5F F8 32 BF 35 10 FF A4 48 FD 92 4F 7C FA 1C 76 85 02 A5 00 82 87 7B 72 45 4F A4 D7 34 E3 55 78 91 8C 5F EF 28 D6 2E 55 ED 54 85 89 E7 66 81 B1 40 25 D9 F7 1A 29 EF D3 14 09 BA 89 F4 59 48 F2 99 8E BA 6C 3E 1C E7 11 17 65 63 53 0E 62 36 B0 F7 19 D3 FD CD 81 28 41 10 69 82 C3 A8 FE EC 47 50 4B 02 03 01 00 01 02 81 80 24 88 D8 00 6F 55 66 CB 58 D2 87 53 19 DA 8B DC 8C 13 F0 32 98 1F 07 E5 76 67 F9 BE 3B A7 B6 61 1F 24 A0 86 E3 3E 77 98 BD 92 FB 85 90 E0 D9 A6 EF 37 36 79 4C 28 22 F8 1F 5C 87 56 B2 CE 5C EB A0 37 34 15 0F 83 54 37 5D C5 95 4E FC 79 D2 92 ED 71 31 FD B9 53 D6 39 87 39 64 5E BC 90 97 68 6E 66 60 B1 FA AB 82 40 69 0D 27 96 90 3C 22 87 41 F9 3F 74 A8 56 55 FF EA 9D 7A 3C 00 96 CB F1 02 41 00 FA AF DE 87 44 86 89 AD C9 92 E8 AF 84 E4 AE 7E 00 38 04 7E 7E 2D 89 3E ED 01 9F 0C 08 0A 7C E0 26 20 26 D0 A7 19 39 6A 73 E3 02 C7 CE F8 51 0F 31 E1 21 9F 7F 9A A1 D2 2C A8 7C BF 1E 3A C4 E7 02 41 00 CD 93 39 AF BC 0A F8 D6 42 1F 22 6E 75 45 1E EB 64 0D B3 54 AD 0F 93 8B 5D 12 FE FD 6C A8 25 18 DD C2 CA 73 90 BC 3A 30 3E 0C FB 09 41 38 E9 77 50 DF 20 69 58 DC E1 0C 27 06 9F 06 04 A8 88 FD 02 40 27 C1 26 1F FB 6C FE 7E 71 DD FB 4A 82 5F A5 90 53 C6 8E 67 E4 E8 A1 C0 39 E3 AC EE 42 84 2F 43 78 A8 56 9F 76 30 58 DB 99 DF 21 3C C0 84 BE 8E 13 51 E9 7C 1A C7 51 EC 3B AA C8 85 A2 6C 9D 77 02 40 31 9A E3 02 9A B7 73 10 10 68 7E E0 74 7F B7 54 49 92 5C C1 83 F9 0C 3B 46 BC 3C B7 5E 2E BC B4 E1 5E 0D 88 11 56 BA 1B C5 FD 4F DE 0D D4 F3 D1 0C BC AA 8F 81 17 DB 5E 19 54 A9 AE C4 14 FE E9 02 41 00 FA 80 7B 6A E2 01 E3 73 60 D9 B2 E1 E7 DE 77 B6 E4 B4 09 19 76 F1 2E F3 49 96 B0 9E 75 05 E5 F8 DF BC 6C DE 95 8B A1 6C 19 A2 64 A0 2D DF 80 0A 5F 80 68 92 52 E8 28 13 03 23 54 95 60 9B 5F E3openssl RSA 密钥 DER to PEM命令
openssl rsa -in rsa_private_pkcs1.der -inform der -out rsa_private_pkcs1.pem