var forge=require("./forge");require("./asn1"),require("./oids"),require("./pbe"),require("./pem"),require("./pbkdf2"),require("./pkcs12"),require("./pss"),require("./rsa"),require("./util"),require("./x509");var asn1=forge.asn1,pki=module.exports=forge.pki=forge.pki||{};pki.pemToDer=function(e){var r=forge.pem.decode(e)[0];if(r.procType&&"ENCRYPTED"===r.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return forge.util.createBuffer(r.body)},pki.privateKeyFromPem=function(e){var r=forge.pem.decode(e)[0];if("PRIVATE KEY"!==r.type&&"RSA PRIVATE KEY"!==r.type){var o=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw o.headerType=r.type,o}if(r.procType&&"ENCRYPTED"===r.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");var p=asn1.fromDer(r.body);return pki.privateKeyFromAsn1(p)},pki.privateKeyToPem=function(e,r){var o={type:"RSA PRIVATE KEY",body:asn1.toDer(pki.privateKeyToAsn1(e)).getBytes()};return forge.pem.encode(o,{maxline:r})},pki.privateKeyInfoToPem=function(e,r){var o={type:"PRIVATE KEY",body:asn1.toDer(e).getBytes()};return forge.pem.encode(o,{maxline:r})};