This Node.js script lets you extract the public key from a PEM certificate and save it locally to your filesystem. Follow the steps below to use the script:
Before using the script, kindly ensure that you have Node.js installed on your system. You can download Node.js from the official website.
-
Download the script:
Download the
extractPublicKeyFromCertificate.js
file from this repository and save it to a location on your computer. -
Open a Terminal or Command Prompt:
Navigate to the directory where you saved the
extractPublicKeyFromCertificate.js
file using the terminal or command prompt. -
Generate Public Key:
To run the script and generate the public key, use the following command:
node extractPublicKeyFromCertificate.js <path/to/certificate.pem> <path/to/public_key.pem>
Replace
<path/to/certificate.pem>
with the path to your PEM certificate file, and<path/to/public_key.pem>
with the desired output file path for the public key to be extracted.