[Pkg-javascript-commits] [node-asn1.js] 187/202: 2560: fix undefined references

Bastien Roucariès rouca at moszumanska.debian.org
Thu Apr 20 19:19:07 UTC 2017


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

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

commit 06f3f085c1ce7b8b5253b2b1417e90eedcf5da60
Author: Fedor Indutny <fedor at indutny.com>
Date:   Fri Sep 23 16:41:40 2016 +0200

    2560: fix undefined references
---
 lib/asn1/base/node.js       |  1 +
 rfc/2560/index.js           | 11 ++++++-----
 rfc/2560/test/basic-test.js | 29 +++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/lib/asn1/base/node.js b/lib/asn1/base/node.js
index 9b771d0..1672f42 100644
--- a/lib/asn1/base/node.js
+++ b/lib/asn1/base/node.js
@@ -170,6 +170,7 @@ tags.forEach(function(tag) {
 });
 
 Node.prototype.use = function use(item) {
+  assert(item);
   var state = this._baseState;
 
   assert(state.use === null);
diff --git a/rfc/2560/index.js b/rfc/2560/index.js
index fc40c1c..27ec7b1 100644
--- a/rfc/2560/index.js
+++ b/rfc/2560/index.js
@@ -19,7 +19,8 @@ var TBSRequest = asn1.define('TBSRequest', function() {
     this.key('version').def('v1').explicit(0).use(rfc5280.Version),
     this.key('requestorName').optional().explicit(1).use(rfc5280.GeneralName),
     this.key('requestList').seqof(Request),
-    this.key('requestExtensions').optional().explicit(2).use(rfc5280.Extensions)
+    this.key('requestExtensions').optional().explicit(2)
+        .seqof(rfc5280.Extension)
   );
 });
 exports.TBSRequest = TBSRequest;
@@ -36,8 +37,8 @@ exports.Signature = Signature;
 var Request = asn1.define('Request', function() {
   this.seq().obj(
     this.key('reqCert').use(CertID),
-    this.key('singleRequestExtensions').optional().explicit(0).use(
-      rfc5280.Extensions)
+    this.key('singleRequestExtensions').optional().explicit(0).seqof(
+        rfc5280.Extension)
   );
 });
 exports.Request = Request;
@@ -84,7 +85,7 @@ var ResponseData = asn1.define('ResponseData', function() {
     this.key('producedAt').gentime(),
     this.key('responses').seqof(SingleResponse),
     this.key('responseExtensions').optional().explicit(0)
-        .use(rfc5280.Extensions)
+        .seqof(rfc5280.Extension)
   );
 });
 exports.ResponseData = ResponseData;
@@ -108,7 +109,7 @@ var SingleResponse = asn1.define('SingleResponse', function() {
     this.key('certStatus').use(CertStatus),
     this.key('thisUpdate').gentime(),
     this.key('nextUpdate').optional().explicit(0).gentime(),
-    this.key('singleExtensions').optional().explicit(1).use(rfc5280.Extensions)
+    this.key('singleExtensions').optional().explicit(1).seqof(rfc5280.Extension)
   );
 });
 exports.SingleResponse = SingleResponse;
diff --git a/rfc/2560/test/basic-test.js b/rfc/2560/test/basic-test.js
index b8a6005..9d36193 100644
--- a/rfc/2560/test/basic-test.js
+++ b/rfc/2560/test/basic-test.js
@@ -47,4 +47,33 @@ describe('asn1.js RFC2560', function() {
     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 = {
+      version: 'v1',
+      requestList: [
+        {
+          reqCert: {
+            hashAlgorithm: { algorithm: [ 1, 3, 14, 3, 2, 26 ] },
+            issuerNameHash: new Buffer('01', 'hex'),
+            issuerKeyHash: new Buffer('02', 'hex'),
+            serialNumber: 0x2b
+          }
+        }
+      ],
+      requestExtensions: [
+        {
+          extnID: [ 1, 3, 6, 1, 5, 5, 7, 48, 1, 2 ],
+          critical: false,
+          extnValue: new Buffer('03', 'hex')
+        }
+      ]
+    };
+
+    var res = {
+      tbsRequest: tbsReq
+    };
+
+    rfc2560.OCSPRequest.encode(res, 'der');
+  });
 });

-- 
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