[Pkg-javascript-commits] [node-asn1.js] 16/21: rfc: es6 let/const everywhere!

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 10:57:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch upstream
in repository node-asn1.js.

commit 0c3fcb946fd65c2978c992d789b93d6e3fe9a044
Author: Fedor Indutny <fedor at indutny.com>
Date:   Tue Oct 31 15:58:46 2017 +0100

    rfc: es6 let/const everywhere!
---
 rfc/2560/index.js           |  36 +++++-----
 rfc/2560/test/basic-test.js |  20 +++---
 rfc/5280/index.js           | 172 ++++++++++++++++++++++----------------------
 rfc/5280/test/basic-test.js |  52 +++++++-------
 4 files changed, 142 insertions(+), 138 deletions(-)

diff --git a/rfc/2560/index.js b/rfc/2560/index.js
index 727a413..b441b13 100644
--- a/rfc/2560/index.js
+++ b/rfc/2560/index.js
@@ -1,7 +1,9 @@
-var asn1 = require('asn1.js');
-var rfc5280 = require('asn1.js-rfc5280');
+'use strict';
 
-var OCSPRequest = asn1.define('OCSPRequest', function() {
+const asn1 = require('asn1.js');
+const rfc5280 = require('asn1.js-rfc5280');
+
+const OCSPRequest = asn1.define('OCSPRequest', function() {
   this.seq().obj(
     this.key('tbsRequest').use(TBSRequest),
     this.key('optionalSignature').optional().explicit(0).use(Signature)
@@ -9,7 +11,7 @@ var OCSPRequest = asn1.define('OCSPRequest', function() {
 });
 exports.OCSPRequest = OCSPRequest;
 
-var TBSRequest = asn1.define('TBSRequest', function() {
+const TBSRequest = asn1.define('TBSRequest', function() {
   this.seq().obj(
     this.key('version').def('v1').explicit(0).use(rfc5280.Version),
     this.key('requestorName').optional().explicit(1).use(rfc5280.GeneralName),
@@ -20,7 +22,7 @@ var TBSRequest = asn1.define('TBSRequest', function() {
 });
 exports.TBSRequest = TBSRequest;
 
-var Signature = asn1.define('Signature', function() {
+const Signature = asn1.define('Signature', function() {
   this.seq().obj(
     this.key('signatureAlgorithm').use(rfc5280.AlgorithmIdentifier),
     this.key('signature').bitstr(),
@@ -29,7 +31,7 @@ var Signature = asn1.define('Signature', function() {
 });
 exports.Signature = Signature;
 
-var Request = asn1.define('Request', function() {
+const Request = asn1.define('Request', function() {
   this.seq().obj(
     this.key('reqCert').use(CertID),
     this.key('singleRequestExtensions').optional().explicit(0).seqof(
@@ -38,7 +40,7 @@ var Request = asn1.define('Request', function() {
 });
 exports.Request = Request;
 
-var OCSPResponse = asn1.define('OCSPResponse', function() {
+const OCSPResponse = asn1.define('OCSPResponse', function() {
   this.seq().obj(
     this.key('responseStatus').use(ResponseStatus),
     this.key('responseBytes').optional().explicit(0).seq().obj(
@@ -51,7 +53,7 @@ var OCSPResponse = asn1.define('OCSPResponse', function() {
 });
 exports.OCSPResponse = OCSPResponse;
 
-var ResponseStatus = asn1.define('ResponseStatus', function() {
+const ResponseStatus = asn1.define('ResponseStatus', function() {
   this.enum({
     0: 'successful',
     1: 'malformed_request',
@@ -63,7 +65,7 @@ var ResponseStatus = asn1.define('ResponseStatus', function() {
 });
 exports.ResponseStatus = ResponseStatus;
 
-var BasicOCSPResponse = asn1.define('BasicOCSPResponse', function() {
+const BasicOCSPResponse = asn1.define('BasicOCSPResponse', function() {
   this.seq().obj(
     this.key('tbsResponseData').use(ResponseData),
     this.key('signatureAlgorithm').use(rfc5280.AlgorithmIdentifier),
@@ -73,7 +75,7 @@ var BasicOCSPResponse = asn1.define('BasicOCSPResponse', function() {
 });
 exports.BasicOCSPResponse = BasicOCSPResponse;
 
-var ResponseData = asn1.define('ResponseData', function() {
+const ResponseData = asn1.define('ResponseData', function() {
   this.seq().obj(
     this.key('version').def('v1').explicit(0).use(rfc5280.Version),
     this.key('responderID').use(ResponderID),
@@ -85,7 +87,7 @@ var ResponseData = asn1.define('ResponseData', function() {
 });
 exports.ResponseData = ResponseData;
 
-var ResponderID = asn1.define('ResponderId', function() {
+const ResponderID = asn1.define('ResponderId', function() {
   this.choice({
     byName: this.explicit(1).use(rfc5280.Name),
     byKey: this.explicit(2).use(KeyHash)
@@ -93,12 +95,12 @@ var ResponderID = asn1.define('ResponderId', function() {
 });
 exports.ResponderID = ResponderID;
 
-var KeyHash = asn1.define('KeyHash', function() {
+const KeyHash = asn1.define('KeyHash', function() {
   this.octstr();
 });
 exports.KeyHash = KeyHash;
 
-var SingleResponse = asn1.define('SingleResponse', function() {
+const SingleResponse = asn1.define('SingleResponse', function() {
   this.seq().obj(
     this.key('certId').use(CertID),
     this.key('certStatus').use(CertStatus),
@@ -109,7 +111,7 @@ var SingleResponse = asn1.define('SingleResponse', function() {
 });
 exports.SingleResponse = SingleResponse;
 
-var CertStatus = asn1.define('CertStatus', function() {
+const CertStatus = asn1.define('CertStatus', function() {
   this.choice({
     good: this.implicit(0).null_(),
     revoked: this.implicit(1).use(RevokedInfo),
@@ -118,7 +120,7 @@ var CertStatus = asn1.define('CertStatus', function() {
 });
 exports.CertStatus = CertStatus;
 
-var RevokedInfo = asn1.define('RevokedInfo', function() {
+const RevokedInfo = asn1.define('RevokedInfo', function() {
   this.seq().obj(
     this.key('revocationTime').gentime(),
     this.key('revocationReason').optional().explicit(0).use(rfc5280.ReasonCode)
@@ -126,7 +128,7 @@ var RevokedInfo = asn1.define('RevokedInfo', function() {
 });
 exports.RevokedInfo = RevokedInfo;
 
-var CertID = asn1.define('CertID', function() {
+const CertID = asn1.define('CertID', function() {
   this.seq().obj(
     this.key('hashAlgorithm').use(rfc5280.AlgorithmIdentifier),
     this.key('issuerNameHash').octstr(),
@@ -136,7 +138,7 @@ var CertID = asn1.define('CertID', function() {
 });
 exports.CertID = CertID;
 
-var Nonce = asn1.define('Nonce', function() {
+const Nonce = asn1.define('Nonce', function() {
   this.octstr();
 });
 exports.Nonce = Nonce;
diff --git a/rfc/2560/test/basic-test.js b/rfc/2560/test/basic-test.js
index 3b1561f..1bf30a9 100644
--- a/rfc/2560/test/basic-test.js
+++ b/rfc/2560/test/basic-test.js
@@ -1,14 +1,14 @@
 'use strict';
 /* global describe it */
 
-var assert = require('assert');
-var rfc2560 = require('..');
+const assert = require('assert');
+const rfc2560 = require('..');
 
-var Buffer = require('buffer').Buffer;
+const Buffer = require('buffer').Buffer;
 
 describe('asn1.js RFC2560', function() {
   it('should decode OCSP response', function() {
-    var data = new Buffer(
+    const data = new Buffer(
       '308201d40a0100a08201cd308201c906092b0601050507300101048201ba308201b630' +
       '819fa216041499e4405f6b145e3e05d9ddd36354fc62b8f700ac180f32303133313133' +
       '303037343531305a30743072304a300906052b0e03021a050004140226ee2f5fa28108' +
@@ -25,11 +25,11 @@ describe('asn1.js RFC2560', function() {
       '2721ff38c709f3ec580d22ff40818dd17f',
       'hex');
 
-    var res = rfc2560.OCSPResponse.decode(data, 'der');
+    const res = rfc2560.OCSPResponse.decode(data, 'der');
     assert.equal(res.responseStatus, 'successful');
     assert.equal(res.responseBytes.responseType, 'id-pkix-ocsp-basic');
 
-    var basic = rfc2560.BasicOCSPResponse.decode(
+    const basic = rfc2560.BasicOCSPResponse.decode(
       res.responseBytes.response,
       'der'
     );
@@ -38,21 +38,21 @@ describe('asn1.js RFC2560', function() {
   });
 
   it('should encode/decode OCSP response', function() {
-    var encoded = rfc2560.OCSPResponse.encode({
+    const encoded = rfc2560.OCSPResponse.encode({
       responseStatus: 'malformed_request',
       responseBytes: {
         responseType: 'id-pkix-ocsp-basic',
         response: 'random-string'
       }
     }, 'der');
-    var decoded = rfc2560.OCSPResponse.decode(encoded, 'der');
+    const decoded = rfc2560.OCSPResponse.decode(encoded, 'der');
     assert.equal(decoded.responseStatus, 'malformed_request');
     assert.equal(decoded.responseBytes.responseType, 'id-pkix-ocsp-basic');
     assert.equal(decoded.responseBytes.response.toString(), 'random-string');
   });
 
   it('should encode OCSP request', function() {
-    var tbsReq = {
+    const tbsReq = {
       version: 'v1',
       requestList: [
         {
@@ -73,7 +73,7 @@ describe('asn1.js RFC2560', function() {
       ]
     };
 
-    var res = {
+    const res = {
       tbsRequest: tbsReq
     };
 
diff --git a/rfc/5280/index.js b/rfc/5280/index.js
index ffb302b..ad4760c 100644
--- a/rfc/5280/index.js
+++ b/rfc/5280/index.js
@@ -1,13 +1,15 @@
-var asn1 = require('asn1.js');
+'use strict';
+
+const asn1 = require('asn1.js');
 
 /**
  * RFC5280 X509 and Extension Definitions
  */
 
-var rfc5280 = exports;
+const rfc5280 = exports;
 
 // OIDs
-var x509OIDs = {
+const x509OIDs = {
   '2 5 29 9': 'subjectDirectoryAttributes',
   '2 5 29 14': 'subjectKeyIdentifier',
   '2 5 29 15': 'keyUsage',
@@ -37,7 +39,7 @@ var x509OIDs = {
 //      tbsCertList          TBSCertList,
 //      signatureAlgorithm   AlgorithmIdentifier,
 //      signature            BIT STRING  }
-var CertificateList = asn1.define('CertificateList', function() {
+const CertificateList = asn1.define('CertificateList', function() {
   this.seq().obj(
     this.key('tbsCertList').use(TBSCertList),
     this.key('signatureAlgorithm').use(AlgorithmIdentifier),
@@ -49,7 +51,7 @@ rfc5280.CertificateList = CertificateList;
 // AlgorithmIdentifier  ::=  SEQUENCE  {
 //      algorithm               OBJECT IDENTIFIER,
 //      parameters              ANY DEFINED BY algorithm OPTIONAL  }
-var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
+const AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function() {
   this.seq().obj(
     this.key('algorithm').objid(),
     this.key('parameters').optional().any()
@@ -61,7 +63,7 @@ rfc5280.AlgorithmIdentifier = AlgorithmIdentifier;
 //      tbsCertificate       TBSCertificate,
 //      signatureAlgorithm   AlgorithmIdentifier,
 //      signature            BIT STRING  }
-var Certificate = asn1.define('Certificate', function() {
+const Certificate = asn1.define('Certificate', function() {
   this.seq().obj(
     this.key('tbsCertificate').use(TBSCertificate),
     this.key('signatureAlgorithm').use(AlgorithmIdentifier),
@@ -81,7 +83,7 @@ rfc5280.Certificate = Certificate;
 //      issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
 //      subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
 //      extensions      [3]  Extensions OPTIONAL
-var TBSCertificate = asn1.define('TBSCertificate', function() {
+const TBSCertificate = asn1.define('TBSCertificate', function() {
   this.seq().obj(
     this.key('version').def('v1').explicit(0).use(Version),
     this.key('serialNumber').int(),
@@ -98,7 +100,7 @@ var TBSCertificate = asn1.define('TBSCertificate', function() {
 rfc5280.TBSCertificate = TBSCertificate;
 
 // Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
-var Version = asn1.define('Version', function() {
+const Version = asn1.define('Version', function() {
   this.int({
     0: 'v1',
     1: 'v2',
@@ -110,7 +112,7 @@ rfc5280.Version = Version;
 // Validity ::= SEQUENCE {
 //      notBefore      Time,
 //      notAfter       Time  }
-var Validity = asn1.define('Validity', function() {
+const Validity = asn1.define('Validity', function() {
   this.seq().obj(
     this.key('notBefore').use(Time),
     this.key('notAfter').use(Time)
@@ -121,7 +123,7 @@ rfc5280.Validity = Validity;
 // Time ::= CHOICE {
 //      utcTime        UTCTime,
 //      generalTime    GeneralizedTime }
-var Time = asn1.define('Time', function() {
+const Time = asn1.define('Time', function() {
   this.choice({
     utcTime: this.utctime(),
     genTime: this.gentime()
@@ -132,7 +134,7 @@ rfc5280.Time = Time;
 // SubjectPublicKeyInfo  ::=  SEQUENCE  {
 //      algorithm            AlgorithmIdentifier,
 //      subjectPublicKey     BIT STRING  }
-var SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() {
+const SubjectPublicKeyInfo = asn1.define('SubjectPublicKeyInfo', function() {
   this.seq().obj(
     this.key('algorithm').use(AlgorithmIdentifier),
     this.key('subjectPublicKey').bitstr()
@@ -152,7 +154,7 @@ rfc5280.SubjectPublicKeyInfo = SubjectPublicKeyInfo;
 //           crlEntryExtensions      Extensions OPTIONAL
 //      }  OPTIONAL,
 //      crlExtensions           [0] Extensions OPTIONAL }
-var TBSCertList = asn1.define('TBSCertList', function() {
+const TBSCertList = asn1.define('TBSCertList', function() {
   this.seq().obj(
     this.key('version').optional().int(),
     this.key('signature').use(AlgorithmIdentifier),
@@ -165,7 +167,7 @@ var TBSCertList = asn1.define('TBSCertList', function() {
 });
 rfc5280.TBSCertList = TBSCertList;
 
-var RevokedCertificate = asn1.define('RevokedCertificate', function() {
+const RevokedCertificate = asn1.define('RevokedCertificate', function() {
   this.seq().obj(
     this.key('userCertificate').use(CertificateSerialNumber),
     this.key('revocationDate').use(Time),
@@ -177,12 +179,12 @@ var RevokedCertificate = asn1.define('RevokedCertificate', function() {
 //      extnID      OBJECT IDENTIFIER,
 //      critical    BOOLEAN DEFAULT FALSE,
 //      extnValue   OCTET STRING }
-var Extension = asn1.define('Extension', function() {
+const Extension = asn1.define('Extension', function() {
   this.seq().obj(
     this.key('extnID').objid(x509OIDs),
     this.key('critical').bool().def(false),
     this.key('extnValue').octstr().contains(function(obj) {
-      var out = x509Extensions[obj.extnID];
+      const out = x509Extensions[obj.extnID];
       // Cope with unknown extensions
       return out ? out : asn1.define('OctString', function() { this.any(); });
     })
@@ -192,7 +194,7 @@ rfc5280.Extension = Extension;
 
 // Name ::= CHOICE { -- only one possibility for now --
 //      rdnSequence  RDNSequence }
-var Name = asn1.define('Name', function() {
+const Name = asn1.define('Name', function() {
   this.choice({
     rdnSequence: this.use(RDNSequence)
   });
@@ -209,7 +211,7 @@ rfc5280.Name = Name;
 //      uniformResourceIdentifier [6]  IA5String,
 //      iPAddress                 [7]  OCTET STRING,
 //      registeredID              [8]  OBJECT IDENTIFIER }
-var GeneralName = asn1.define('GeneralName', function() {
+const GeneralName = asn1.define('GeneralName', function() {
   this.choice({
     otherName: this.implicit(0).use(AnotherName),
     rfc822Name: this.implicit(1).ia5str(),
@@ -224,7 +226,7 @@ var GeneralName = asn1.define('GeneralName', function() {
 rfc5280.GeneralName = GeneralName;
 
 // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
-var GeneralNames = asn1.define('GeneralNames', function() {
+const GeneralNames = asn1.define('GeneralNames', function() {
   this.seqof(GeneralName);
 });
 rfc5280.GeneralNames = GeneralNames;
@@ -232,7 +234,7 @@ rfc5280.GeneralNames = GeneralNames;
 // AnotherName ::= SEQUENCE {
 //      type-id    OBJECT IDENTIFIER,
 //      value      [0] EXPLICIT ANY DEFINED BY type-id }
-var AnotherName = asn1.define('AnotherName', function() {
+const AnotherName = asn1.define('AnotherName', function() {
   this.seq().obj(
     this.key('type-id').objid(),
     this.key('value').explicit(0).any()
@@ -243,7 +245,7 @@ rfc5280.AnotherName = AnotherName;
 // EDIPartyName ::= SEQUENCE {
 //      nameAssigner              [0]  DirectoryString OPTIONAL,
 //      partyName                 [1]  DirectoryString }
-var EDIPartyName = asn1.define('EDIPartyName', function() {
+const EDIPartyName = asn1.define('EDIPartyName', function() {
   this.seq().obj(
     this.key('nameAssigner').implicit(0).optional().use(DirectoryString),
     this.key('partyName').implicit(1).use(DirectoryString)
@@ -252,14 +254,14 @@ var EDIPartyName = asn1.define('EDIPartyName', function() {
 rfc5280.EDIPartyName = EDIPartyName;
 
 // RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
-var RDNSequence = asn1.define('RDNSequence', function() {
+const RDNSequence = asn1.define('RDNSequence', function() {
   this.seqof(RelativeDistinguishedName);
 });
 rfc5280.RDNSequence = RDNSequence;
 
 // RelativeDistinguishedName ::=
 //      SET SIZE (1..MAX) OF AttributeTypeAndValue
-var RelativeDistinguishedName = asn1.define('RelativeDistinguishedName',
+const RelativeDistinguishedName = asn1.define('RelativeDistinguishedName',
   function() {
     this.setof(AttributeTypeAndValue);
   });
@@ -268,7 +270,7 @@ rfc5280.RelativeDistinguishedName = RelativeDistinguishedName;
 // AttributeTypeAndValue ::= SEQUENCE {
 //      type     AttributeType,
 //      value    AttributeValue }
-var AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() {
+const AttributeTypeAndValue = asn1.define('AttributeTypeAndValue', function() {
   this.seq().obj(
     this.key('type').use(AttributeType),
     this.key('value').use(AttributeValue)
@@ -279,7 +281,7 @@ rfc5280.AttributeTypeAndValue = AttributeTypeAndValue;
 // Attribute               ::= SEQUENCE {
 //       type             AttributeType,
 //       values    SET OF AttributeValue }
-var Attribute = asn1.define('Attribute', function() {
+const Attribute = asn1.define('Attribute', function() {
   this.seq().obj(
     this.key('type').use(AttributeType),
     this.key('values').setof(AttributeValue)
@@ -288,13 +290,13 @@ var Attribute = asn1.define('Attribute', function() {
 rfc5280.Attribute = Attribute;
 
 // AttributeType ::= OBJECT IDENTIFIER
-var AttributeType = asn1.define('AttributeType', function() {
+const AttributeType = asn1.define('AttributeType', function() {
   this.objid();
 });
 rfc5280.AttributeType = AttributeType;
 
 // AttributeValue ::= ANY -- DEFINED BY AttributeType
-var AttributeValue = asn1.define('AttributeValue', function() {
+const AttributeValue = asn1.define('AttributeValue', function() {
   this.any();
 });
 rfc5280.AttributeValue = AttributeValue;
@@ -305,7 +307,7 @@ rfc5280.AttributeValue = AttributeValue;
 //       universalString         UniversalString (SIZE (1..MAX)),
 //       utf8String              UTF8String (SIZE (1..MAX)),
 //       bmpString               BMPString (SIZE (1..MAX)) }
-var DirectoryString = asn1.define('DirectoryString', function() {
+const DirectoryString = asn1.define('DirectoryString', function() {
   this.choice({
     teletexString: this.t61str(),
     printableString: this.printstr(),
@@ -320,7 +322,7 @@ rfc5280.DirectoryString = DirectoryString;
 //     keyIdentifier             [0] KeyIdentifier            OPTIONAL,
 //     authorityCertIssuer       [1] GeneralNames             OPTIONAL,
 //     authorityCertSerialNumber [2] CertificateSerialNumber  OPTIONAL }
-var AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() {
+const AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() {
   this.seq().obj(
     this.key('keyIdentifier').implicit(0).optional().use(KeyIdentifier),
     this.key('authorityCertIssuer').implicit(1).optional().use(GeneralNames),
@@ -331,13 +333,13 @@ var AuthorityKeyIdentifier = asn1.define('AuthorityKeyIdentifier', function() {
 rfc5280.AuthorityKeyIdentifier = AuthorityKeyIdentifier;
 
 // KeyIdentifier ::= OCTET STRING
-var KeyIdentifier = asn1.define('KeyIdentifier', function() {
+const KeyIdentifier = asn1.define('KeyIdentifier', function() {
   this.octstr();
 });
 rfc5280.KeyIdentifier = KeyIdentifier;
 
 // CertificateSerialNumber  ::=  INTEGER
-var CertificateSerialNumber = asn1.define('CertificateSerialNumber',
+const CertificateSerialNumber = asn1.define('CertificateSerialNumber',
   function() {
     this.int();
   });
@@ -348,7 +350,7 @@ rfc5280.CertificateSerialNumber = CertificateSerialNumber;
 //    built-in-domain-defined-attributes    BuiltInDomainDefinedAttributes
 //                                            OPTIONAL,
 //    extension-attributes ExtensionAttributes OPTIONAL }
-var ORAddress = asn1.define('ORAddress', function() {
+const ORAddress = asn1.define('ORAddress', function() {
   this.seq().obj(
     this.key('builtInStandardAttributes').use(BuiltInStandardAttributes),
     this.key('builtInDomainDefinedAttributes').optional()
@@ -368,7 +370,7 @@ rfc5280.ORAddress = ORAddress;
 //    numeric-user-identifier   [4] IMPLICIT NumericUserIdentifier OPTIONAL,
 //    personal-name             [5] IMPLICIT PersonalName OPTIONAL,
 //    organizational-unit-names [6] IMPLICIT OrganizationalUnitNames OPTIONAL }
-var BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes',
+const BuiltInStandardAttributes = asn1.define('BuiltInStandardAttributes',
   function() {
     this.seq().obj(
       this.key('countryName').optional().use(CountryName),
@@ -391,7 +393,7 @@ rfc5280.BuiltInStandardAttributes = BuiltInStandardAttributes;
 // CountryName ::= CHOICE {
 //    x121-dcc-code         NumericString,
 //    iso-3166-alpha2-code  PrintableString }
-var CountryName = asn1.define('CountryName', function() {
+const CountryName = asn1.define('CountryName', function() {
   this.choice({
     x121DccCode: this.numstr(),
     iso3166Alpha2Code: this.printstr()
@@ -403,7 +405,7 @@ rfc5280.CountryName = CountryName;
 // AdministrationDomainName ::= CHOICE {
 //    numeric   NumericString,
 //    printable PrintableString }
-var AdministrationDomainName = asn1.define('AdministrationDomainName',
+const AdministrationDomainName = asn1.define('AdministrationDomainName',
   function() {
     this.choice({
       numeric: this.numstr(),
@@ -413,19 +415,19 @@ var AdministrationDomainName = asn1.define('AdministrationDomainName',
 rfc5280.AdministrationDomainName = AdministrationDomainName;
 
 // NetworkAddress ::= X121Address
-var NetworkAddress = asn1.define('NetworkAddress', function() {
+const NetworkAddress = asn1.define('NetworkAddress', function() {
   this.use(X121Address);
 });
 rfc5280.NetworkAddress = NetworkAddress;
 
 // X121Address ::= NumericString
-var X121Address = asn1.define('X121Address', function() {
+const X121Address = asn1.define('X121Address', function() {
   this.numstr();
 });
 rfc5280.X121Address = X121Address;
 
 // TerminalIdentifier ::= PrintableString
-var TerminalIdentifier = asn1.define('TerminalIdentifier', function() {
+const TerminalIdentifier = asn1.define('TerminalIdentifier', function() {
   this.printstr();
 });
 rfc5280.TerminalIdentifier = TerminalIdentifier;
@@ -433,7 +435,7 @@ rfc5280.TerminalIdentifier = TerminalIdentifier;
 // PrivateDomainName ::= CHOICE {
 //    numeric   NumericString,
 //    printable PrintableString }
-var PrivateDomainName = asn1.define('PrivateDomainName', function() {
+const PrivateDomainName = asn1.define('PrivateDomainName', function() {
   this.choice({
     numeric: this.numstr(),
     printable: this.printstr()
@@ -442,13 +444,13 @@ var PrivateDomainName = asn1.define('PrivateDomainName', function() {
 rfc5280.PrivateDomainName = PrivateDomainName;
 
 // OrganizationName ::= PrintableString
-var OrganizationName = asn1.define('OrganizationName', function() {
+const OrganizationName = asn1.define('OrganizationName', function() {
   this.printstr();
 });
 rfc5280.OrganizationName = OrganizationName;
 
 // NumericUserIdentifier ::= NumericString
-var NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() {
+const NumericUserIdentifier = asn1.define('NumericUserIdentifier', function() {
   this.numstr();
 });
 rfc5280.NumericUserIdentifier = NumericUserIdentifier;
@@ -458,7 +460,7 @@ rfc5280.NumericUserIdentifier = NumericUserIdentifier;
 //    given-name  [1] IMPLICIT PrintableString OPTIONAL,
 //    initials    [2] IMPLICIT PrintableString OPTIONAL,
 //    generation-qualifier [3] IMPLICIT PrintableString OPTIONAL }
-var PersonalName = asn1.define('PersonalName', function() {
+const PersonalName = asn1.define('PersonalName', function() {
   this.set().obj(
     this.key('surname').implicit(0).printstr(),
     this.key('givenName').implicit(1).printstr(),
@@ -470,7 +472,7 @@ rfc5280.PersonalName = PersonalName;
 
 // OrganizationalUnitNames ::= SEQUENCE SIZE (1..ub-organizational-units)
 //                              OF OrganizationalUnitName
-var OrganizationalUnitNames = asn1.define('OrganizationalUnitNames',
+const OrganizationalUnitNames = asn1.define('OrganizationalUnitNames',
   function() {
     this.seqof(OrganizationalUnitName);
   });
@@ -478,7 +480,7 @@ rfc5280.OrganizationalUnitNames = OrganizationalUnitNames;
 
 // OrganizationalUnitName ::= PrintableString (SIZE
 //                     (1..ub-organizational-unit-name-length))
-var OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() {
+const OrganizationalUnitName = asn1.define('OrganizationalUnitName', function() {
   this.printstr();
 });
 rfc5280.OrganizationalUnitName = OrganizationalUnitName;
@@ -486,7 +488,7 @@ rfc5280.OrganizationalUnitName = OrganizationalUnitName;
 // uiltInDomainDefinedAttributes ::= SEQUENCE SIZE
 //                     (1..ub-domain-defined-attributes)
 //                       OF BuiltInDomainDefinedAttribute
-var BuiltInDomainDefinedAttributes = asn1.define(
+const BuiltInDomainDefinedAttributes = asn1.define(
   'BuiltInDomainDefinedAttributes', function() {
     this.seqof(BuiltInDomainDefinedAttribute);
   });
@@ -496,7 +498,7 @@ rfc5280.BuiltInDomainDefinedAttributes = BuiltInDomainDefinedAttributes;
 //    type PrintableString (SIZE (1..ub-domain-defined-attribute-type-length)),
 //    value PrintableString (SIZE (1..ub-domain-defined-attribute-value-length))
 //}
-var BuiltInDomainDefinedAttribute = asn1.define('BuiltInDomainDefinedAttribute',
+const BuiltInDomainDefinedAttribute = asn1.define('BuiltInDomainDefinedAttribute',
   function() {
     this.seq().obj(
       this.key('type').printstr(),
@@ -508,7 +510,7 @@ rfc5280.BuiltInDomainDefinedAttribute = BuiltInDomainDefinedAttribute;
 
 // ExtensionAttributes ::= SET SIZE (1..ub-extension-attributes) OF
 //                ExtensionAttribute
-var ExtensionAttributes = asn1.define('ExtensionAttributes', function() {
+const ExtensionAttributes = asn1.define('ExtensionAttributes', function() {
   this.seqof(ExtensionAttribute);
 });
 rfc5280.ExtensionAttributes = ExtensionAttributes;
@@ -516,7 +518,7 @@ rfc5280.ExtensionAttributes = ExtensionAttributes;
 // ExtensionAttribute ::=  SEQUENCE {
 //    extension-attribute-type [0] IMPLICIT INTEGER,
 //    extension-attribute-value [1] ANY DEFINED BY extension-attribute-type }
-var ExtensionAttribute = asn1.define('ExtensionAttribute', function() {
+const ExtensionAttribute = asn1.define('ExtensionAttribute', function() {
   this.seq().obj(
     this.key('extensionAttributeType').implicit(0).int(),
     this.key('extensionAttributeValue').any().explicit(1).int()
@@ -525,7 +527,7 @@ var ExtensionAttribute = asn1.define('ExtensionAttribute', function() {
 rfc5280.ExtensionAttribute = ExtensionAttribute;
 
 // SubjectKeyIdentifier ::= KeyIdentifier
-var SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function() {
+const SubjectKeyIdentifier = asn1.define('SubjectKeyIdentifier', function() {
   this.use(KeyIdentifier);
 });
 rfc5280.SubjectKeyIdentifier = SubjectKeyIdentifier;
@@ -541,13 +543,13 @@ rfc5280.SubjectKeyIdentifier = SubjectKeyIdentifier;
 //      cRLSign                 (6),
 //      encipherOnly            (7),
 //      decipherOnly            (8) }
-var KeyUsage = asn1.define('KeyUsage', function() {
+const KeyUsage = asn1.define('KeyUsage', function() {
   this.bitstr();
 });
 rfc5280.KeyUsage = KeyUsage;
 
 // CertificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
-var CertificatePolicies = asn1.define('CertificatePolicies', function() {
+const CertificatePolicies = asn1.define('CertificatePolicies', function() {
   this.seqof(PolicyInformation);
 });
 rfc5280.CertificatePolicies = CertificatePolicies;
@@ -556,7 +558,7 @@ rfc5280.CertificatePolicies = CertificatePolicies;
 //      policyIdentifier   CertPolicyId,
 //      policyQualifiers   SEQUENCE SIZE (1..MAX) OF PolicyQualifierInfo
 //                           OPTIONAL }
-var PolicyInformation = asn1.define('PolicyInformation', function() {
+const PolicyInformation = asn1.define('PolicyInformation', function() {
   this.seq().obj(
     this.key('policyIdentifier').use(CertPolicyId),
     this.key('policyQualifiers').optional().use(PolicyQualifiers)
@@ -565,12 +567,12 @@ var PolicyInformation = asn1.define('PolicyInformation', function() {
 rfc5280.PolicyInformation = PolicyInformation;
 
 // CertPolicyId ::= OBJECT IDENTIFIER
-var CertPolicyId = asn1.define('CertPolicyId', function() {
+const CertPolicyId = asn1.define('CertPolicyId', function() {
   this.objid();
 });
 rfc5280.CertPolicyId = CertPolicyId;
 
-var PolicyQualifiers = asn1.define('PolicyQualifiers', function() {
+const PolicyQualifiers = asn1.define('PolicyQualifiers', function() {
   this.seqof(PolicyQualifierInfo);
 });
 rfc5280.PolicyQualifiers = PolicyQualifiers;
@@ -578,7 +580,7 @@ rfc5280.PolicyQualifiers = PolicyQualifiers;
 // PolicyQualifierInfo ::= SEQUENCE {
 //      policyQualifierId  PolicyQualifierId,
 //      qualifier          ANY DEFINED BY policyQualifierId }
-var PolicyQualifierInfo = asn1.define('PolicyQualifierInfo', function() {
+const PolicyQualifierInfo = asn1.define('PolicyQualifierInfo', function() {
   this.seq().obj(
     this.key('policyQualifierId').use(PolicyQualifierId),
     this.key('qualifier').any()
@@ -587,7 +589,7 @@ var PolicyQualifierInfo = asn1.define('PolicyQualifierInfo', function() {
 rfc5280.PolicyQualifierInfo = PolicyQualifierInfo;
 
 // PolicyQualifierId ::= OBJECT IDENTIFIER
-var PolicyQualifierId = asn1.define('PolicyQualifierId', function() {
+const PolicyQualifierId = asn1.define('PolicyQualifierId', function() {
   this.objid();
 });
 rfc5280.PolicyQualifierId = PolicyQualifierId;
@@ -595,12 +597,12 @@ rfc5280.PolicyQualifierId = PolicyQualifierId;
 // PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
 //      issuerDomainPolicy      CertPolicyId,
 //      subjectDomainPolicy     CertPolicyId }
-var PolicyMappings = asn1.define('PolicyMappings', function() {
+const PolicyMappings = asn1.define('PolicyMappings', function() {
   this.seqof(PolicyMapping);
 });
 rfc5280.PolicyMappings = PolicyMappings;
 
-var PolicyMapping = asn1.define('PolicyMapping', function() {
+const PolicyMapping = asn1.define('PolicyMapping', function() {
   this.seq().obj(
     this.key('issuerDomainPolicy').use(CertPolicyId),
     this.key('subjectDomainPolicy').use(CertPolicyId)
@@ -609,19 +611,19 @@ var PolicyMapping = asn1.define('PolicyMapping', function() {
 rfc5280.PolicyMapping = PolicyMapping;
 
 // SubjectAltName ::= GeneralNames
-var SubjectAlternativeName = asn1.define('SubjectAlternativeName', function() {
+const SubjectAlternativeName = asn1.define('SubjectAlternativeName', function() {
   this.use(GeneralNames);
 });
 rfc5280.SubjectAlternativeName = SubjectAlternativeName;
 
 // IssuerAltName ::= GeneralNames
-var IssuerAlternativeName = asn1.define('IssuerAlternativeName', function() {
+const IssuerAlternativeName = asn1.define('IssuerAlternativeName', function() {
   this.use(GeneralNames);
 });
 rfc5280.IssuerAlternativeName = IssuerAlternativeName;
 
 // SubjectDirectoryAttributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
-var SubjectDirectoryAttributes = asn1.define('SubjectDirectoryAttributes',
+const SubjectDirectoryAttributes = asn1.define('SubjectDirectoryAttributes',
   function() {
     this.seqof(Attribute);
   });
@@ -630,7 +632,7 @@ rfc5280.SubjectDirectoryAttributes = SubjectDirectoryAttributes;
 // BasicConstraints ::= SEQUENCE {
 //         cA                      BOOLEAN DEFAULT FALSE,
 //         pathLenConstraint       INTEGER (0..MAX) OPTIONAL }
-var BasicConstraints = asn1.define('BasicConstraints', function() {
+const BasicConstraints = asn1.define('BasicConstraints', function() {
   this.seq().obj(
     this.key('cA').bool().def(false),
     this.key('pathLenConstraint').optional().int()
@@ -641,7 +643,7 @@ rfc5280.BasicConstraints = BasicConstraints;
 // NameConstraints ::= SEQUENCE {
 //            permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
 //            excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
-var NameConstraints = asn1.define('NameConstraints', function() {
+const NameConstraints = asn1.define('NameConstraints', function() {
   this.seq().obj(
     this.key('permittedSubtrees').implicit(0).optional().use(GeneralSubtrees),
     this.key('excludedSubtrees').implicit(1).optional().use(GeneralSubtrees)
@@ -650,7 +652,7 @@ var NameConstraints = asn1.define('NameConstraints', function() {
 rfc5280.NameConstraints = NameConstraints;
 
 // GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
-var GeneralSubtrees = asn1.define('GeneralSubtrees', function() {
+const GeneralSubtrees = asn1.define('GeneralSubtrees', function() {
   this.seqof(GeneralSubtree);
 });
 rfc5280.GeneralSubtrees = GeneralSubtrees;
@@ -659,7 +661,7 @@ rfc5280.GeneralSubtrees = GeneralSubtrees;
 //            base                    GeneralName,
 //            minimum         [0]     BaseDistance DEFAULT 0,
 //            maximum         [1]     BaseDistance OPTIONAL }
-var GeneralSubtree = asn1.define('GeneralSubtree', function() {
+const GeneralSubtree = asn1.define('GeneralSubtree', function() {
   this.seq().obj(
     this.key('base').use(GeneralName),
     this.key('minimum').implicit(0).def(0).use(BaseDistance),
@@ -669,7 +671,7 @@ var GeneralSubtree = asn1.define('GeneralSubtree', function() {
 rfc5280.GeneralSubtree = GeneralSubtree;
 
 // BaseDistance ::= INTEGER
-var BaseDistance = asn1.define('BaseDistance', function() {
+const BaseDistance = asn1.define('BaseDistance', function() {
   this.int();
 });
 rfc5280.BaseDistance = BaseDistance;
@@ -677,7 +679,7 @@ rfc5280.BaseDistance = BaseDistance;
 // PolicyConstraints ::= SEQUENCE {
 //         requireExplicitPolicy           [0] SkipCerts OPTIONAL,
 //         inhibitPolicyMapping            [1] SkipCerts OPTIONAL }
-var PolicyConstraints = asn1.define('PolicyConstraints', function() {
+const PolicyConstraints = asn1.define('PolicyConstraints', function() {
   this.seq().obj(
     this.key('requireExplicitPolicy').implicit(0).optional().use(SkipCerts),
     this.key('inhibitPolicyMapping').implicit(1).optional().use(SkipCerts)
@@ -686,25 +688,25 @@ var PolicyConstraints = asn1.define('PolicyConstraints', function() {
 rfc5280.PolicyConstraints = PolicyConstraints;
 
 // SkipCerts ::= INTEGER
-var SkipCerts = asn1.define('SkipCerts', function() {
+const SkipCerts = asn1.define('SkipCerts', function() {
   this.int();
 });
 rfc5280.SkipCerts = SkipCerts;
 
 // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
-var ExtendedKeyUsage = asn1.define('ExtendedKeyUsage', function() {
+const ExtendedKeyUsage = asn1.define('ExtendedKeyUsage', function() {
   this.seqof(KeyPurposeId);
 });
 rfc5280.ExtendedKeyUsage = ExtendedKeyUsage;
 
 // KeyPurposeId ::= OBJECT IDENTIFIER
-var KeyPurposeId = asn1.define('KeyPurposeId', function() {
+const KeyPurposeId = asn1.define('KeyPurposeId', function() {
   this.objid();
 });
 rfc5280.KeyPurposeId = KeyPurposeId;
 
 // RLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint
-var CRLDistributionPoints = asn1.define('CRLDistributionPoints', function() {
+const CRLDistributionPoints = asn1.define('CRLDistributionPoints', function() {
   this.seqof(DistributionPoint);
 });
 rfc5280.CRLDistributionPoints = CRLDistributionPoints;
@@ -713,7 +715,7 @@ rfc5280.CRLDistributionPoints = CRLDistributionPoints;
 //         distributionPoint       [0]     DistributionPointName OPTIONAL,
 //         reasons                 [1]     ReasonFlags OPTIONAL,
 //         cRLIssuer               [2]     GeneralNames OPTIONAL }
-var DistributionPoint = asn1.define('DistributionPoint', function() {
+const DistributionPoint = asn1.define('DistributionPoint', function() {
   this.seq().obj(
     this.key('distributionPoint').optional().explicit(0)
       .use(DistributionPointName),
@@ -726,7 +728,7 @@ rfc5280.DistributionPoint = DistributionPoint;
 // DistributionPointName ::= CHOICE {
 //         fullName                [0]     GeneralNames,
 //         nameRelativeToCRLIssuer [1]     RelativeDistinguishedName }
-var DistributionPointName = asn1.define('DistributionPointName', function() {
+const DistributionPointName = asn1.define('DistributionPointName', function() {
   this.choice({
     fullName: this.implicit(0).use(GeneralNames),
     nameRelativeToCRLIssuer: this.implicit(1).use(RelativeDistinguishedName)
@@ -744,26 +746,26 @@ rfc5280.DistributionPointName = DistributionPointName;
 //         certificateHold         (6),
 //         privilegeWithdrawn      (7),
 //         aACompromise            (8) }
-var ReasonFlags = asn1.define('ReasonFlags', function() {
+const ReasonFlags = asn1.define('ReasonFlags', function() {
   this.bitstr();
 });
 rfc5280.ReasonFlags = ReasonFlags;
 
 // InhibitAnyPolicy ::= SkipCerts
-var InhibitAnyPolicy = asn1.define('InhibitAnyPolicy', function() {
+const InhibitAnyPolicy = asn1.define('InhibitAnyPolicy', function() {
   this.use(SkipCerts);
 });
 rfc5280.InhibitAnyPolicy = InhibitAnyPolicy;
 
 // FreshestCRL ::= CRLDistributionPoints
-var FreshestCRL = asn1.define('FreshestCRL', function() {
+const FreshestCRL = asn1.define('FreshestCRL', function() {
   this.use(CRLDistributionPoints);
 });
 rfc5280.FreshestCRL = FreshestCRL;
 
 // AuthorityInfoAccessSyntax  ::=
 //         SEQUENCE SIZE (1..MAX) OF AccessDescription
-var AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax',
+const AuthorityInfoAccessSyntax = asn1.define('AuthorityInfoAccessSyntax',
   function() {
     this.seqof(AccessDescription);
   });
@@ -772,7 +774,7 @@ rfc5280.AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax;
 // AccessDescription  ::=  SEQUENCE {
 //         accessMethod          OBJECT IDENTIFIER,
 //         accessLocation        GeneralName  }
-var AccessDescription = asn1.define('AccessDescription', function() {
+const AccessDescription = asn1.define('AccessDescription', function() {
   this.seq().obj(
     this.key('accessMethod').objid(),
     this.key('accessLocation').use(GeneralName)
@@ -782,7 +784,7 @@ rfc5280.AccessDescription = AccessDescription;
 
 // SubjectInfoAccessSyntax  ::=
 //            SEQUENCE SIZE (1..MAX) OF AccessDescription
-var SubjectInformationAccess = asn1.define('SubjectInformationAccess',
+const SubjectInformationAccess = asn1.define('SubjectInformationAccess',
   function() {
     this.seqof(AccessDescription);
   });
@@ -793,12 +795,12 @@ rfc5280.SubjectInformationAccess = SubjectInformationAccess;
  */
 
 // CRLNumber ::= INTEGER
-var CRLNumber = asn1.define('CRLNumber', function() {
+const CRLNumber = asn1.define('CRLNumber', function() {
   this.int();
 });
 rfc5280.CRLNumber = CRLNumber;
 
-var DeltaCRLIndicator = asn1.define('DeltaCRLIndicator', function() {
+const DeltaCRLIndicator = asn1.define('DeltaCRLIndicator', function() {
   this.use(CRLNumber);
 });
 rfc5280.DeltaCRLIndicator = DeltaCRLIndicator;
@@ -810,7 +812,7 @@ rfc5280.DeltaCRLIndicator = DeltaCRLIndicator;
 //         onlySomeReasons            [3] ReasonFlags OPTIONAL,
 //         indirectCRL                [4] BOOLEAN DEFAULT FALSE,
 //         onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
-var IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
+const IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
   function() {
     this.seq().obj(
       this.key('distributionPoint').explicit(0).optional()
@@ -836,7 +838,7 @@ rfc5280.IssuingDistributionPoint = IssuingDistributionPoint;
 //         removeFromCRL           (8),
 //         privilegeWithdrawn      (9),
 //         aACompromise           (10) }
-var ReasonCode = asn1.define('ReasonCode', function() {
+const ReasonCode = asn1.define('ReasonCode', function() {
   this.enum({
     0: 'unspecified',
     1: 'keyCompromise',
@@ -853,19 +855,19 @@ var ReasonCode = asn1.define('ReasonCode', function() {
 rfc5280.ReasonCode = ReasonCode;
 
 // InvalidityDate ::=  GeneralizedTime
-var InvalidityDate = asn1.define('InvalidityDate', function() {
+const InvalidityDate = asn1.define('InvalidityDate', function() {
   this.gentime();
 });
 rfc5280.InvalidityDate = InvalidityDate;
 
 // CertificateIssuer ::=     GeneralNames
-var CertificateIssuer = asn1.define('CertificateIssuer', function() {
+const CertificateIssuer = asn1.define('CertificateIssuer', function() {
   this.use(GeneralNames);
 });
 rfc5280.CertificateIssuer = CertificateIssuer;
 
 // OID label to extension model mapping
-var x509Extensions = {
+const x509Extensions = {
   subjectDirectoryAttributes: SubjectDirectoryAttributes,
   subjectKeyIdentifier: SubjectKeyIdentifier,
   keyUsage: KeyUsage,
diff --git a/rfc/5280/test/basic-test.js b/rfc/5280/test/basic-test.js
index 327676b..31ca86b 100644
--- a/rfc/5280/test/basic-test.js
+++ b/rfc/5280/test/basic-test.js
@@ -1,20 +1,20 @@
 'use strict';
 /* global describe it */
 
-var assert = require('assert');
-var fs = require('fs');
-var asn1 = require('../../../');
-var rfc5280 = require('..');
+const assert = require('assert');
+const fs = require('fs');
+const asn1 = require('../../../');
+const rfc5280 = require('..');
 
-var Buffer = require('buffer').Buffer;
+const Buffer = require('buffer').Buffer;
 
 describe('asn1.js RFC5280', function() {
 
   it('should decode Certificate', function() {
-    var data = fs.readFileSync(__dirname + '/fixtures/cert1.crt');
-    var res = rfc5280.Certificate.decode(data, 'der');
+    const data = fs.readFileSync(__dirname + '/fixtures/cert1.crt');
+    const res = rfc5280.Certificate.decode(data, 'der');
 
-    var tbs = res.tbsCertificate;
+    const tbs = res.tbsCertificate;
     assert.equal(tbs.version, 'v3');
     assert.deepEqual(tbs.serialNumber,
       new asn1.bignum('462e4256bb1194dc', 16));
@@ -26,16 +26,16 @@ describe('asn1.js RFC5280', function() {
   it('should decode ECC Certificate', function() {
     // Symantec Class 3 ECC 256 bit Extended Validation CA from
     // https://knowledge.symantec.com/support/ssl-certificates-support/index?page=content&actp=CROSSLINK&id=AR1908
-    var data = fs.readFileSync(__dirname + '/fixtures/cert2.crt');
-    var res = rfc5280.Certificate.decode(data, 'der');
+    const data = fs.readFileSync(__dirname + '/fixtures/cert2.crt');
+    const res = rfc5280.Certificate.decode(data, 'der');
 
-    var tbs = res.tbsCertificate;
+    const tbs = res.tbsCertificate;
     assert.equal(tbs.version, 'v3');
     assert.deepEqual(tbs.serialNumber,
       new asn1.bignum('4d955d20af85c49f6925fbab7c665f89', 16));
     assert.equal(tbs.signature.algorithm.join('.'),
       '1.2.840.10045.4.3.3');  // RFC5754
-    var spki = rfc5280.SubjectPublicKeyInfo.encode(tbs.subjectPublicKeyInfo,
+    const spki = rfc5280.SubjectPublicKeyInfo.encode(tbs.subjectPublicKeyInfo,
       'der');
     // spki check to the output of
     // openssl x509 -in ecc_cert.pem -pubkey -noout |
@@ -48,29 +48,29 @@ describe('asn1.js RFC5280', function() {
   });
 
   it('should decode AuthorityInfoAccess', function() {
-    var data = new Buffer('305a302b06082b06010505073002861f687474703a2f2f70' +
+    const data = new Buffer('305a302b06082b06010505073002861f687474703a2f2f70' +
                           '6b692e676f6f676c652e636f6d2f47494147322e63727430' +
                           '2b06082b06010505073001861f687474703a2f2f636c6965' +
                           '6e7473312e676f6f676c652e636f6d2f6f637370',
     'hex');
 
-    var info = rfc5280.AuthorityInfoAccessSyntax.decode(data, 'der');
+    const info = rfc5280.AuthorityInfoAccessSyntax.decode(data, 'der');
 
     assert(info[0].accessMethod);
   });
 
   it('should decode directoryName in GeneralName', function() {
-    var data = new Buffer('a411300f310d300b06022a03160568656c6c6f', 'hex');
+    const data = new Buffer('a411300f310d300b06022a03160568656c6c6f', 'hex');
 
-    var name = rfc5280.GeneralName.decode(data, 'der');
+    const name = rfc5280.GeneralName.decode(data, 'der');
     assert.equal(name.type, 'directoryName');
   });
 
   it('should decode Certificate Extensions', function() {
-    var data;
-    var cert;
+    let data;
+    let cert;
 
-    var extensions = {};
+    let extensions = {};
     data = fs.readFileSync(__dirname + '/fixtures/cert3.crt');
     cert = rfc5280.Certificate.decode(data, 'der');
     cert.tbsCertificate.extensions.forEach(function(e) {
@@ -107,16 +107,16 @@ describe('asn1.js RFC5280', function() {
   });
 
   it('should encode/decode IssuingDistributionPoint', function() {
-    var input = {
+    let input = {
       onlyContainsUserCerts: true,
       onlyContainsCACerts: false,
       indirectCRL: true,
       onlyContainsAttributeCerts: false
     };
 
-    var data = rfc5280.IssuingDistributionPoint.encode(input);
+    let data = rfc5280.IssuingDistributionPoint.encode(input);
 
-    var decoded = rfc5280.IssuingDistributionPoint.decode(data);
+    let decoded = rfc5280.IssuingDistributionPoint.decode(data);
     assert.deepEqual(decoded, input);
 
     input = {
@@ -134,8 +134,8 @@ describe('asn1.js RFC5280', function() {
   });
 
   it('should decode Revoked Certificates', function() {
-    var data;
-    var crl;
+    let data;
+    let crl;
 
     // Downloadable CRL (containing two certificates) from distribution point available on cert1.crt
     data = fs.readFileSync(__dirname + '/fixtures/cert1.crl');
@@ -145,12 +145,12 @@ describe('asn1.js RFC5280', function() {
     assert.deepEqual(crl.tbsCertList.revokedCertificates[0].userCertificate,
       new asn1.bignum('764bedd38afd51f7', 16));
 
-    var cert1 = crl.tbsCertList.revokedCertificates[1];
+    const cert1 = crl.tbsCertList.revokedCertificates[1];
     assert.deepEqual(cert1.userCertificate,
       new asn1.bignum('31da3380182af9b2', 16));
     assert.equal(cert1.crlEntryExtensions.length, 1);
 
-    var ext1 = cert1.crlEntryExtensions[0];
+    const ext1 = cert1.crlEntryExtensions[0];
     assert.equal(ext1.extnID, 'reasonCode');
     assert.equal(ext1.extnValue, 'affiliationChanged');
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-asn1.js.git



More information about the Pkg-javascript-commits mailing list