Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tder

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tder

small ASN1-DER and PEM parser in about 100 lines

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

tder

small ASN1 DER and PEM parser in pure js

wow, just 100 lines of code and the module can parse ASN1-DER data structures. it is made to read informations from certificates. tested with certificates generated with hyperledger cryptogen and the github.com certificate

// test.js
var tder = require('./index');
var fs = require('fs');


var asn1 = tder.parsePem(`
-----BEGIN CERTIFICATE-----
MIIHeTCCBmGgAwIBAgIQC/20CQrXteZAwwsWyVKaJzANBgkqhkiG9w0BAQsFADB1
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
...
nT8MIG1u1zF8MA0GCSqGSIb3DQEBCwUAA4IBAQCLbNtkxuspqycq8h1EpbmAX0wM
FrBHTFxqIP6kDnxiLElBrZngtY07ietaYZVLQN/ETyqLQftsf8TecwTklbjvm8NT
JqbaIVifYwqwNN+4lRxS3F5lNlA/il12IOgbRioLI62o8G0DaEUQgHNf8vSG
-----END CERTIFICATE-----
`);
asn1 = tder.interpreter.certInterpreter(asn1);
// {
//   "serial": "0bfdb4090ad7b5e640c30b16c9529a27",
//   "issuer": {
//     "countryName": "US",
//     "organizationName": "DigiCert Inc",
//     "organizationalUnitName": "www.digicert.com",
//     "commonName": "DigiCert SHA2 Extended Validation Server CA"
//   },
//   "dueTime": {    
//     "notBefore": "2016-03-10T00:00:00.000Z",
//     "notAfter": "2018-05-17T12:00:00.000Z"
//   },
//   "subject": {
//     "businessCategory": "Private Organization",
//     "jurisdictionCountryName": "US",
//     "jurisdictionStateOrProvinceName": "Delaware",
//     "serialNumber": "5157550",
//     "streetAddress": "88 Colin P Kelly, Jr Street",
//     "postalCode": "94107",
//     "countryName": "US",
//     "stateOrProvinceName": "California",
//     "localityName": "San Francisco",
//     "organizationName": "GitHub, Inc.",
//     "commonName": "github.com"
//   }
// }

you can clearly see the issue and subject, to verify if the datastructures are are valid and are signed correctly, you need to look elsewhere.

Keywords

FAQs

Package last updated on 30 Aug 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc