如何将“PEM编码的证书文件”转换为文本文件

时间:2018-01-18 23:15:02

标签: javascript angularjs

Rest API将Perm作为“PEM编码的证书文件”返回。如何将其转换为文本文件,如下面这个文件:

-----BEGIN CERTIFICATE-----
MIIDDTCCAfWgAwIBAgIRAOzcoUj/60jiktDEnrghGfcwDQYJKoZIhvcNAQELBQAw
QjEfMB0GA1UECgwWdGVzdC1qcGhhbS51bml0eWRldi5pbzEfMB0GA1UEAwwWdGVz
dC1qcGhhbS51bml0eWRldi5pbzAeFw0xODAxMTYyMjQ0MjJaFw0yODAxMTUyMjQ0
MjJaMEIxHzAdBgNVBAoMFnRlc3QtanBoYW0udW5pdHlkZXYuaW8xHzAdBgNVBAMM
FnRlc3QtanBoYW0udW5pdHlkZXYuaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
ggEKAoIBAQDl+WFbLhUWsjb5fAofYvI1zijEHaF52ldGahfByOjGVyJ8UaGi//CM
L7PPqbJmSceeMIdfAie5f0GVXH+NqbersH33u6oETnRG+WO9aKMTB+bbOIDSkS33
ufIhf6wSit/GhUjujnE3xuPopttS0WpcqUCFED5k2m2mumeJkmOTjngVexrKMfvQ
Va/ubYOUNpCQnTgtNxaE93qDoylB+CFmrZ3CBDbu/LnF6YNu5NYlFGoOqAeCFacr
l4ZkTwbXo3MPH/PZlqVdFQKQtwMdqioXeo0N41zaEFtU5S+YS5VArWEQwof8B/zF
5xrhIY/n2iyM5N5ln9DDJm2YwqR43BWVAgMBAAEwDQYJKoZIhvcNAQELBQADggEB
AMVqd9kDsg+VpjA01fgxlbQmRwzNbK736OEQpEh5iIAnEleoewSt2nY4U/eCJ5eE
XqsCEvRMxWldT0soUKQxrVkK2NmnyansRCm7kFmZ3l2IJjKR909wrBdQASKZOyeG
PvwAeAHHMX1CZnFC+71WvMfnr+Cg0kI4nYeeaTVQTsTIxEt91rsFg9+YVm99ci0J
J9NMGk6Zm+DAHN09E7I2tHBxk61E1mVd9S7627XAPSVIghcZORf7dgxoRWsux3pt
I5k/2PMrSxYRx4rPDz+J7jE7dKy5ClDj1WOmPp2D/fbojXb3YotYbEwsjBAtVfDO
HBtT4Ws0m+3FBjvhemIMLK0=
-----END CERTIFICATE-----

在AngularJS中,Javascript 感谢

2 个答案:

答案 0 :(得分:0)

PEM编码证书已经是base64文本文件。阅读http://www.gtopia.org/blog/2010/02/der-vs-crt-vs-cer-vs-pem-certificates/

答案 1 :(得分:0)

猜猜是什么...您不需要转换文件!

  1. 复制并粘贴您的文件(以保留原始文件) 即:35544arrtsfevctdtys767.crt到35544arrtsfevctdtys767-copy.crt
  2. 将已复制的文件(35544arrtsfevctdtys767-copy.crt)重命名为您的名称- choice.TXT,即abc.txt(忽略以下警告,该文件将在以下情况下无法使用: 您更改类型,然后单击确定。)
  3. 您现在拥有文件的TEXT版本...

就是这么简单!