[Pkg-javascript-commits] [node-asn1.js] 162/202: 5280: fix IssuingDistributionPoint

Bastien Roucariès rouca at moszumanska.debian.org
Thu Apr 20 19:19:04 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 01293bccade8d7b6b03b5622968c78b16df8e2e5
Author: Fedor Indutny <fedor at indutny.com>
Date:   Fri May 20 17:27:22 2016 -0400

    5280: fix IssuingDistributionPoint
---
 rfc/5280/index.js           | 13 +++++++------
 rfc/5280/test/basic-test.js | 27 +++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/rfc/5280/index.js b/rfc/5280/index.js
index cce0b9e..975a267 100644
--- a/rfc/5280/index.js
+++ b/rfc/5280/index.js
@@ -811,12 +811,13 @@ rfc5280.DeltaCRLIndicator = DeltaCRLIndicator;
 var IssuingDistributionPoint = asn1.define('IssuingDistributionPoint',
                                            function() {
   this.seq().obj(
-    this.key('distributionPoint').use(DistributionPointName),
-    this.key('onlyContainsUserCerts').def(false).bool(),
-    this.key('onlyContainsCACerts').def(false).bool(),
-    this.key('onlySomeReasons').use(ReasonFlags),
-    this.key('indirectCRL').def(false).bool(),
-    this.key('onlyContainsAttributeCerts').def(false).bool()
+    this.key('distributionPoint').implicit(0).optional()
+        .use(DistributionPointName),
+    this.key('onlyContainsUserCerts').implicit(1).def(false).bool(),
+    this.key('onlyContainsCACerts').implicit(2).def(false).bool(),
+    this.key('onlySomeReasons').implicit(3).optional().use(ReasonFlags),
+    this.key('indirectCRL').implicit(4).def(false).bool(),
+    this.key('onlyContainsAttributeCerts').implicit(5).def(false).bool()
   );
 });
 rfc5280.IssuingDistributionPoint = IssuingDistributionPoint;
diff --git a/rfc/5280/test/basic-test.js b/rfc/5280/test/basic-test.js
index 3ce8ed9..26f6349 100644
--- a/rfc/5280/test/basic-test.js
+++ b/rfc/5280/test/basic-test.js
@@ -102,4 +102,31 @@ describe('asn1.js RFC5280', function() {
     });
     assert.equal(extensions.basicConstraints.extnValue.cA, true);
   });
+
+  it('should encode/decode IssuingDistributionPoint', function() {
+    var input = {
+      onlyContainsUserCerts: true,
+      onlyContainsCACerts: false,
+      indirectCRL: true,
+      onlyContainsAttributeCerts: false
+    };
+
+    var data = rfc5280.IssuingDistributionPoint.encode(input);
+
+    var decoded = rfc5280.IssuingDistributionPoint.decode(data);
+    assert.deepEqual(decoded, input);
+
+    var input = {
+      onlyContainsUserCerts: true,
+      onlyContainsCACerts: false,
+      indirectCRL: true,
+      onlyContainsAttributeCerts: false,
+      onlySomeReasons: { unused: 0, data: new Buffer('asdf') }
+    };
+
+    var data = rfc5280.IssuingDistributionPoint.encode(input);
+
+    var decoded = rfc5280.IssuingDistributionPoint.decode(data);
+    assert.deepEqual(decoded, input);
+  });
 });

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