Created
April 18, 2019 19:25
-
-
Save glasser/8dd5498e824bad648ce3c8f7a2035c0a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pem = require('pem'); | |
const fs = require('fs'); | |
let pemFile = fs.readFileSync(process.argv[2], 'utf8'); | |
pemFile = pemFile.replace(/BEGIN PRIVATE KEY/, 'BEGIN RSA PRIVATE KEY'); | |
pemFile = pemFile.replace(/END PRIVATE KEY/, 'END RSA PRIVATE KEY'); | |
pem.getPublicKey(pemFile, function (err, result) { | |
if (err) { | |
console.error("ERROR", err); | |
} else { | |
console.log("ok"); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "pem-check", | |
"version": "1.0.0", | |
"license": "MIT", | |
"dependencies": { | |
"pem": "^1.8.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment