
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Convert a x509 certificate to JSON format
View Demo
·
Report Bug
·
Request Feature
This project converts x509 certificates into JSON format. It provides both a command line interface and an API.
To get a local copy up and running follow these simple steps.
Run the following command to install the CLI
npm install -g cert2json
In your npm package install the dependency
npm install cert2json
The CLI will print the JSON. You can use jq to process the output. Below is an example printing the certificate issuer.
➜ cert2json -h
usage: cert2json file
➜ cert2json google.com.cer | jq '.tbs.issuer.full'
"C=US, O=Google Trust Services, CN=GTS CA 1O1"
➜
Import cert2json and call parseFromFile. The certificate can be DER or PEM format.
// Import the library
const cert2json = require('cert2json')
// Parse the certificate, resulting in a JSON object
const cert = cert2json.parseFromFile('./certificates/google.com.cer')
// Print the issuer
console.log(cert.tbs.issuer.full)
Results in:
C=US, O=Google Trust Services, CN=GTS CA 1O1
Alternatively you can parse the certificate from memory. The parse function expects a Buffer containing the certificate data.
// Import the library
const cert2json = require('cert2json')
const fs = require('fs')
// Read the certificate into a buffer
const certificatePath = './certificates/example.com.cer'
const certificateBuffer = fs.readFileSync(certificatePath)
// Parse the buffer contents
const cert = cert2json.parse(certificateBuffer)
// Print the certificate
console.log(JSON.stringify(cert, null, 2))
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)Distributed under the MIT License. See LICENSE for more information.
FAQs
Convert x509 certificate to json
The npm package cert2json receives a total of 374 weekly downloads. As such, cert2json popularity was classified as not popular.
We found that cert2json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.