Skip to content

Instantly share code, notes, and snippets.

@bmeck
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save bmeck/e20ff68fc7b19bc70652 to your computer and use it in GitHub Desktop.

Select an option

Save bmeck/e20ff68fc7b19bc70652 to your computer and use it in GitHub Desktop.
var asn = require('asn1.js');
var rfc3280 = require('asn1.js/rfc/3280');
var CRLReason = rfc3280.CRLReason;
var Certificate = rfc3280.Certificate;
var fs = require('fs');
global.log = false;
var cert = Certificate.decode(fs.readFileSync('sandbox/valid-cert/cacert.der'), 'der')
var exts = cert.tbsCertificate.extensions;
var CRLDistPoints = asn.define('CRL Distribution Points', function() {
this.seq()
.seq()
.obj(
this.key('distributionPoint').choice({
fullName: this.use(rfc3280.Name),
nameRelativeToCRLIssuer: this.use(rfc3280.RelativeDistinguishedName)
}),
this.key('reasons').optional().use(CRLReason),
this.key('cRLIssuer').optional().use(rfc3280.Name)
);
});
console.log(exts[0].extnValue.toString('hex'))
console.log(CRLDistPoints.decode(exts[0].extnValue, 'der'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment