Guest User

Untitled

a guest
Aug 21st, 2019
56
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2.  
  3. JS='
  4. function certToPEM(cert) {
  5. if (cert.indexOf("BEGIN CERTIFICATE") === -1 && cert.indexOf("END CERTIFICATE") === -1) {
  6. return `-----BEGIN CERTIFICATE-----\n${cert.match(/.{1,64}/g).join("\n")}\n-----END CERTIFICATE-----\n`;
  7. } else {
  8. return cert;
  9. }
  10. }
  11. process.stdin.resume();
  12. process.stdin.setEncoding("utf8");
  13. var cert = "";
  14. process.stdin.on("data", function(buf) {
  15. cert += buf;
  16. });
  17. process.stdin.on("end", function() {
  18. console.log(certToPEM(cert));
  19. });
  20. '
  21.  
  22. node -e "$JS"
RAW Paste Data