1.0.6 • Published 2 years ago

cert-infos v1.0.6

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

certificate-infos: Node.js

Receive RSA certificate information (distinguishedName, commonName, validFrom, validTo,...) from a pem or der encoded file.

##Publications:

https://blog.appit-online.de/publications/

##Table of contents:

Quickstart

Installing the library

npm install cert-infos --save

Using the library

import * as certInfo from 'cert-infos';

/**
 * Given a pem certificate file, get certificate information.
 * @param {string} pemCertPath The path to a certificate file.
 */
const {certificate, certificateOriginal} = certInfo.getRSACertInfoPem(pemCertPath);
console.log('The short certificate information:');
console.log(certificate);
/*
{
        "issuer": {
            "distinguishedName": "CN=Test CA,OU=CA,O=Test GmbH,C=DE",
            "components": {
                "email": "",
                "commonName": "Test CA",
                "organizationalUnit": "CA",
                "organizationName": "Test GmbH",
                "localityName": "",
                "stateName": "",
                "country": "DE"
            }
        },
        "subject": {
            "distinguishedName": "CN=Test1 CA,OU=CA,O=Test1 GmbH,C=DE",
            "components": {
                "email": "",
                "commonName": "Test CA",
                "organizationalUnit": "CA",
                "organizationName": "Test GmbH",
                "localityName": "",
                "stateName": "",
                "country": "DE"
            }
        },
        "serialNumber": "01",
        "validFrom": "2019-01-16T11:55:00.000Z",
        "validTo": "2028-01-11T12:15:00.000Z",
        "version": 3
    }
*/


console.log('The unconverted certificate data:');
console.log(certificateOriginal)
import * as certInfo from 'cert-infos';

/**
 * Given a der certificate file, get certificate information.
 * @param {string} derCertPath The path to a certificate file.
 */
const {certificate, certificateOriginal} = certInfo.getRSACertInfoDER(derCertPath);
console.log('The short certificate information:');
console.log(certificate);

console.log('The unconverted certificate data:');
console.log(certificateOriginal)

Supported Node.js Versions

Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js.

License

Apache Version 2.0

See LICENSE