Created
May 4, 2015 21:15
-
-
Save bmeck/8e0863ec2007c157c7d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| global.log = false; | |
| var dp = asn.define('distributionPoint', function () { | |
| this.implicit().choice({ | |
| fullName: this.explicit(0).any(), | |
| nameRelativeToCRLIssuer: this.explicit(1).use(rfc3280.RelativeDistinguishedName) | |
| }); | |
| }); | |
| var DistPoint = asn.define('Distribution Points', function() { | |
| this.seq().implict()./*what goes here??*/( | |
| this.key('a').explicit(0).use(dp), | |
| this.key('b').explicit(1).use(CRLReason), | |
| this.key('c').explicit(2).use(rfc3280.Name) | |
| ); | |
| }); | |
| var CRLDistPoints = asn.define('CRL Distribution Points', function() { | |
| this.seqof(DistPoint); | |
| }); | |
| global.log = true; | |
| console.log(exts[0].extnValue.toString('hex').toUpperCase()) | |
| require('fs').writeFileSync('gu', exts[0].extnValue) | |
| console.log('----') | |
| 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