How do I convert an XML RSA key to a PEM file?

前端 未结 5 1535
既然无缘
既然无缘 2020-12-14 21:31

I have two XML files, structured as follows:

My Key


   ... 
   ..         


        
5条回答
  •  天命终不由人
    2020-12-14 21:55

    Since xmlseclibs is PHP it seems like another PHP solution might be desirable. Here's how:

    loadKey('
       ... 
       ... 
      

    ...

    ... ... ... ... ...
    '); $privatekey = $rsa->getPrivateKey(); $publickey = $rsa->getPublicKey(); ?>

    phpseclib has built in support for XML keys, PuTTY keys and PKCS1 keys. It'll auto detect the format and load it and getPrivateKey / getPublicKey will output PKCS1 formatted keys by default if no parameters are provided. More info:

    http://phpseclib.sourceforge.net/rsa/examples.html#convert

提交回复
热议问题