Skip to content

Commit

Permalink
10.5.22 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kjur committed May 23, 2022
1 parent 4274a59 commit 2613c64
Show file tree
Hide file tree
Showing 28 changed files with 5,899 additions and 5,912 deletions.
15 changes: 14 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@

ChangeLog for jsrsasign

DERBitString, KeyUsage and tsp PKIFailureInfo critical bug fix
* Changes from 10.5.21 to 10.5.22 (2022-May-24)
- src/asn1.js
- DERBitString critical bugfix
- src/asn1tsp.js
- PKIFailureInfo critical bugfix
- src/asn1x509.js
- KeyUsage critical bugfix
- src/base64.x
- namearraytobinstr critical bugfix
- test/qunit-do-{asn1,asn1tsp,asn1x509,base64x}.html
- add and fix some test cases for above

DERBitString, KeyUsage and tsp PKIFailureInfo fix
* Changes from 10.5.20 to 10.5.21 (2022-May-23)
* Changes from 10.5.20 to 10.5.21 (2022-May-23) *RELEASE RESIGNED*
- src/asn1x509.js
- KeyUsage bugfix, refactoring
- src/asn1tsp.js
Expand Down
8 changes: 4 additions & 4 deletions api/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ <h2><a href="symbols/src/asn1-1.0.js.html">asn1-1.0.js</a></h2>


<dt class="heading">Version:</dt>
<dd>jsrsasign 10.5.21 asn1 1.0.25 (2022-May-23)</dd>
<dd>jsrsasign 10.5.22 asn1 1.0.26 (2022-May-24)</dd>



Expand Down Expand Up @@ -643,7 +643,7 @@ <h2><a href="symbols/src/asn1tsp-1.0.js.html">asn1tsp-1.0.js</a></h2>


<dt class="heading">Version:</dt>
<dd>jsrsasign 10.5.21 asn1tsp 2.0.8 (2022-May-23)</dd>
<dd>jsrsasign 10.5.22 asn1tsp 2.0.9 (2022-May-24)</dd>



Expand All @@ -662,7 +662,7 @@ <h2><a href="symbols/src/asn1x509-1.0.js.html">asn1x509-1.0.js</a></h2>


<dt class="heading">Version:</dt>
<dd>jsrsasign 10.5.21 asn1x509 2.1.15 (2022-May-23)</dd>
<dd>jsrsasign 10.5.22 asn1x509 2.1.16 (2022-May-24)</dd>



Expand All @@ -681,7 +681,7 @@ <h2><a href="symbols/src/base64x-1.1.js.html">base64x-1.1.js</a></h2>


<dt class="heading">Version:</dt>
<dd>jsrsasign 10.5.21 base64x 1.1.27 (2022-May-23)</dd>
<dd>jsrsasign 10.5.22 base64x 1.1.28 (2022-May-24)</dd>



Expand Down
4 changes: 2 additions & 2 deletions api/symbols/global__.html
Original file line number Diff line number Diff line change
Expand Up @@ -3395,8 +3395,8 @@ <h1 class="classTitle">


<pre class="code">db = { a: 0, b: 3, c: 8, d: 9, e: 17, f: 19 };
namearraytobinstr(['a', 'c', 'd'], db) &rarr: '1100000001'
namearraytobinstr(['c', 'b'], db) &rarr: '100001000'</pre>
namearraytobinstr(['a', 'c', 'd'], db) &rarr: '1000000011'
namearraytobinstr(['c', 'b'], db) &rarr: '000100001'</pre>



Expand Down
1,733 changes: 867 additions & 866 deletions api/symbols/src/asn1-1.0.js.html

Large diffs are not rendered by default.

1,516 changes: 760 additions & 756 deletions api/symbols/src/asn1tsp-1.0.js.html

Large diffs are not rendered by default.

8,243 changes: 4,107 additions & 4,136 deletions api/symbols/src/asn1x509-1.0.js.html

Large diffs are not rendered by default.

96 changes: 51 additions & 45 deletions api/symbols/src/base64x-1.1.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kjur-jsrsasign",
"version": "10.5.21",
"version": "10.5.22",
"main": "jsrsasign-all-min.js",
"description": "The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES, JWS and JWT in pure JavaScript.",
"license": "MIT",
Expand Down
10 changes: 5 additions & 5 deletions jsrsasign-all-min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions jsrsasign-jwths-min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions jsrsasign-rsa-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion min/asn1-1.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion min/asn1tsp-1.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion min/asn1x509-1.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion min/base64x-1.1.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions npm/lib/jsrsasign-all-min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions npm/lib/jsrsasign-jwths-min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions npm/lib/jsrsasign-rsa-min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions npm/lib/jsrsasign.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsrsasign",
"version": "10.5.21",
"version": "10.5.22",
"description": "opensource free pure JavaScript cryptographic library supports RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp and CAdES and JSON Web Signature(JWS)/Token(JWT)/Key(JWK).",
"main": "lib/jsrsasign.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions src/asn1-1.0.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* asn1-1.0.25.js (c) 2013-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
/* asn1-1.0.26.js (c) 2013-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
*/
/*
* asn1.js - ASN.1 DER encoder classes
Expand All @@ -16,7 +16,7 @@
* @fileOverview
* @name asn1-1.0.js
* @author Kenji Urushima kenji.urushima@gmail.com
* @version jsrsasign 10.5.21 asn1 1.0.25 (2022-May-23)
* @version jsrsasign 10.5.22 asn1 1.0.26 (2022-May-24)
* @since jsrsasign 2.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
Expand Down Expand Up @@ -974,6 +974,7 @@ extendClass(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
* NOTE1: 'params' can be omitted.<br/>
* NOTE2: 'obj' parameter have been supported since
* asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).<br/>
*
* @example
* // default constructor
* o = new KJUR.asn1.DERBitString();
Expand Down Expand Up @@ -1048,7 +1049,7 @@ KJUR.asn1.DERBitString = function(params) {
* o.setByBinaryString("001"); // leading zeros ignored
*/
this.setByBinaryString = function(binaryString) {
binaryString = binaryString.replace(/^0+/, '');
binaryString = binaryString.replace(/0+$/, '');
var unusedBits = 8 - binaryString.length % 8;
if (unusedBits == 8) unusedBits = 0;

Expand Down
10 changes: 7 additions & 3 deletions src/asn1tsp-1.0.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* asn1tsp-2.0.8.js (c) 2014-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
/* asn1tsp-2.0.9.js (c) 2014-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
*/
/*
* asn1tsp.js - ASN.1 DER encoder classes for RFC 3161 Time Stamp Protocol
Expand All @@ -16,7 +16,7 @@
* @fileOverview
* @name asn1tsp-1.0.js
* @author Kenji Urushima kenji.urushima@gmail.com
* @version jsrsasign 10.5.21 asn1tsp 2.0.8 (2022-May-23)
* @version jsrsasign 10.5.22 asn1tsp 2.0.9 (2022-May-24)
* @since jsrsasign 4.5.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
Expand Down Expand Up @@ -860,6 +860,10 @@ KJUR.asn1.tsp.PKIFailureInfo = function(params) {
if (typeof params == "number" &&
0 <= params && params <= 25) {
d |= 1 << params;
var s = d.toString(2);
var r = "";
for (var i = s.length - 1; i >= 0; i--) r += s[i];
return r;
} else if (typeof params == "string" &&
_nameValue[params] != undefined) {
return namearraytobinstr([params], _nameValue);
Expand All @@ -870,7 +874,7 @@ KJUR.asn1.tsp.PKIFailureInfo = function(params) {
throw new _Error("wrong params");
}

return d.toString(2);
return
};

this.tohex = function() {
Expand Down
33 changes: 2 additions & 31 deletions src/asn1x509-1.0.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* asn1x509-2.1.15.js (c) 2013-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
/* asn1x509-2.1.16.js (c) 2013-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
*/
/*
* asn1x509.js - ASN.1 DER encoder classes for X.509 certificate
Expand All @@ -16,7 +16,7 @@
* @fileOverview
* @name asn1x509-1.0.js
* @author Kenji Urushima kenji.urushima@gmail.com
* @version jsrsasign 10.5.21 asn1x509 2.1.15 (2022-May-23)
* @version jsrsasign 10.5.22 asn1x509 2.1.16 (2022-May-24)
* @since jsrsasign 2.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
Expand Down Expand Up @@ -638,35 +638,6 @@ KJUR.asn1.x509.KeyUsage = function(params) {
this.oid = "2.5.29.15";
if (params !== undefined) this.params = params;
};
KJUR.asn1.x509.KeyUsage_bak = function(params) {
KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this, params);
var _KEYUSAGE_NAME = X509.KEYUSAGE_NAME;

this.getExtnValueHex = function() {
return this.asn1ExtnValue.tohex();
};

this.oid = "2.5.29.15";
if (params !== undefined) {
if (params.bin !== undefined) {
this.asn1ExtnValue = new KJUR.asn1.DERBitString(params);
}
if (params.names !== undefined &&
params.names.length !== undefined) {
var names = params.names;
var s = "000000000";
for (var i = 0; i < names.length; i++) {
for (var j = 0; j < _KEYUSAGE_NAME.length; j++) {
if (names[i] === _KEYUSAGE_NAME[j]) {
s = s.substring(0, j) + '1' +
s.substring(j + 1, s.length);
}
}
}
this.asn1ExtnValue = new KJUR.asn1.DERBitString({bin: s});
}
}
};
extendClass(KJUR.asn1.x509.KeyUsage, KJUR.asn1.x509.Extension);

/**
Expand Down
16 changes: 11 additions & 5 deletions src/base64x-1.1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* base64x-1.1.27 (c) 2012-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
/* base64x-1.1.28 (c) 2012-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
*/
/*
* base64x.js - Base64url and supplementary functions for Tom Wu's base64.js library
Expand All @@ -16,7 +16,7 @@
* @fileOverview
* @name base64x-1.1.js
* @author Kenji Urushima kenji.urushima@gmail.com
* @version jsrsasign 10.5.21 base64x 1.1.27 (2022-May-23)
* @version jsrsasign 10.5.22 base64x 1.1.28 (2022-May-24)
* @since jsrsasign 2.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
Expand Down Expand Up @@ -1799,15 +1799,21 @@ function binstrtobitstr(s) {
*
* @example
* db = { a: 0, b: 3, c: 8, d: 9, e: 17, f: 19 };
* namearraytobinstr(['a', 'c', 'd'], db) &rarr: '1100000001'
* namearraytobinstr(['c', 'b'], db) &rarr: '100001000'
* namearraytobinstr(['a', 'c', 'd'], db) &rarr: '1000000011'
* namearraytobinstr(['c', 'b'], db) &rarr: '000100001'
*/
function namearraytobinstr (namearray, namedb) {
var d = 0;
for (var i = 0; i < namearray.length; i++) {
d |= 1 << namedb[namearray[i]];
}
return d.toString(2);

var s = d.toString(2);
var r = "";
for (var i = s.length - 1; i >=0; i--) {
r += s[i];
}
return r;
}

// =======================================================
Expand Down
29 changes: 15 additions & 14 deletions test/qunit-do-asn1.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@

d.setByBinaryString("1");
equal(d.tohex(), "03020780", "1 unused=7");
d.setByBinaryString("100");
equal(d.tohex(), "03020580", "100 unused=5");
d.setByBinaryString("001");
equal(d.tohex(), "03020520", "001 unused=5");
d.setByBinaryString('1011');
equal(d.tohex(), "030204b0", "1011 > ub=4, b0");
d.setByBinaryString('1011000');
equal(d.tohex(), "030201b0", "1011000 > ub=1, b0");
d.setByBinaryString('01011');
equal(d.tohex(), "03020358", "01011 > ub=3, b0");
d.setByBinaryString('11111111');
equal(d.tohex(), "030200ff", "11111111 > ub=0, ff");
d.setByBinaryString('111111111');
Expand All @@ -96,23 +96,24 @@
d.setUnusedBitsAndHexValue(5, "bad0");
equal(d.tohex(), "030305bad0", "setUnusedBitsAndHexValue > ub=5, bad0");

d.setByBooleanArray([true, false, true, true, false]);
equal(d.tohex(), "030203b0", "setByBooleanArray([t,f,t,t,f]) > ub=3, b0");
d.setByBooleanArray([true, false, false, true, true]);
equal(d.tohex(), "03020398", "setByBooleanArray([t,f,f,t,t]) 10011 > ub=3, b0");

d = new KJUR.asn1.DERBitString({"hex":"04bac0"});
equal(d.tohex(), "030304bac0", "constructor hex 04bac0");

d = new KJUR.asn1.DERBitString({"bin":"1011"});
equal(d.tohex(), "030204b0", "constructor bin 1011");
d = new KJUR.asn1.DERBitString({"bin":"0000011"});
equal(d.tohex(), "03020106", "constructor bin 0000011");


var d2 = new KJUR.asn1.DERBitString({"hex":"04bac0"});
equal(d2.tohex(), "030304bac0", "constructor hex 04bac0");
var d3 = new KJUR.asn1.DERBitString({"bin":"1011"});
equal(d3.tohex(), "030204b0", "constructor bin 1011");
var d4 = new KJUR.asn1.DERBitString({"array": [true,false,true,true]});
equal(d4.tohex(), "030204b0", "constructor array [t,f,t,t]");
var d5 = new KJUR.asn1.DERBitString({obj:{seq: [{int: 3},{prnstr: {str: "aaa"}}]}});
equal(d5.tohex(), "030b0030080201031303616161", "constructor params asn1");
});





test("OctetString Test", function() {
var d = new KJUR.asn1.DEROctetString();
d.setString('aaa');
Expand Down
18 changes: 10 additions & 8 deletions test/qunit-do-asn1tsp.html
Original file line number Diff line number Diff line change
Expand Up @@ -332,31 +332,33 @@
o = new KJUR.asn1.tsp.PKIFailureInfo(0);
equal(o.getEncodedHex(), "03020780", "0");
o = new KJUR.asn1.tsp.PKIFailureInfo(2);
equal(o.getEncodedHex(), "03020580", "2");
equal(o.getEncodedHex(), "03020520", "2");
o = new KJUR.asn1.tsp.PKIFailureInfo(25);
equal(o.getEncodedHex(), "03050680000000", "25");
equal(o.getEncodedHex(), "03050600000040", "25");
o = new KJUR.asn1.tsp.PKIFailureInfo('badAlg');
equal(o.getEncodedHex(), "03020780", "badAlg");
o = new KJUR.asn1.tsp.PKIFailureInfo('badRequest');
equal(o.getEncodedHex(), "03020580", "badRequest");
equal(o.getEncodedHex(), "03020520", "badRequest");
o = new KJUR.asn1.tsp.PKIFailureInfo('systemFailure');
equal(o.getEncodedHex(), "03050680000000", "systemFailure");
equal(o.getEncodedHex(), "03050600000040", "systemFailure");
o = new KJUR.asn1.tsp.PKIFailureInfo(['badAlg','badRequest']);
equal(o.getEncodedHex(), "030205a0", "[badAlg,badRequest]");
o = new KJUR.asn1.tsp.PKIFailureInfo(['badAlg','badRequest','systemFailure']);
equal(o.getEncodedHex(), "030506a0000040", "[badAlg,badRequest,systemFailure]");
});

test("PKIFailureInfo.getBinValue test", function() {
var o;
o = new KJUR.asn1.tsp.PKIFailureInfo(0);
equal(o.getBinValue(), "1", "0");
o = new KJUR.asn1.tsp.PKIFailureInfo(2);
equal(o.getBinValue(), "100", "2");
equal(o.getBinValue(), "001", "2");
o = new KJUR.asn1.tsp.PKIFailureInfo(25);
equal(o.getBinValue(), "10000000000000000000000000", "25");
equal(o.getBinValue(), "00000000000000000000000001", "25");
o = new KJUR.asn1.tsp.PKIFailureInfo('timeNotAvailable');
equal(o.getBinValue(), "100000000000000", "timeNotAvailable");
equal(o.getBinValue(), "000000000000001", "timeNotAvailable");
o = new KJUR.asn1.tsp.PKIFailureInfo(['badAlg','systemFailure','badRequest']);
equal(o.getBinValue(), "10000000000000000000000101", "[badAlg,systemFailure,badRequest]");
equal(o.getBinValue(), "10100000000000000000000001", "[badAlg,systemFailure,badRequest]");
});

test("TimeStampReq", function() {
Expand Down
14 changes: 10 additions & 4 deletions test/qunit-do-asn1x509.html
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,18 @@
equal(o.tohex(), "300e0603551d0f0101ff0404030206c0", "bin 11 critical getEncodedHex");
o = new KJUR.asn1.x509.KeyUsage({'names': ['digitalSignature', 'nonRepudiation']});
equal(o.tohex(), "300b0603551d0f0404030206c0", "name [digitalSignature, nonRepudiation]");
o = new KJUR.asn1.x509.KeyUsage({'bin':'11000000000'});
equal(o.tohex(), "300c0603551d0f0405030305c000", "bin 110000000");
o = new KJUR.asn1.x509.KeyUsage({'bin':'000000011'});
equal(o.tohex(), "300c0603551d0f04050303070180", "bin 000000011");
o = new KJUR.asn1.x509.KeyUsage({'names': ['encipherOnly', 'decipherOnly']});
equal(o.tohex(), "300c0603551d0f0405030307c000", "name [encipherOnly, decipherOnly]");
equal(o.tohex(), "300c0603551d0f04050303070180", "name [encipherOnly, decipherOnly]");
o = new KJUR.asn1.x509.KeyUsage({'bin':'1000011'});
equal(o.tohex(), "300b0603551d0f040403020186", "bin 1000011");
o = new KJUR.asn1.x509.KeyUsage({'names': ['digitalSignature','keyCertSign','cRLSign']});
equal(o.tohex(), "300b0603551d0f0404030201c2", "name [dsig,certsign,crlsign]");
equal(o.tohex(), "300b0603551d0f040403020186", "name [dsig,certsign,crlsign]");
o = new KJUR.asn1.x509.KeyUsage({'bin':'0000011'});
equal(o.tohex(), "300b0603551d0f040403020106", "bin 0000011");
o = new KJUR.asn1.x509.KeyUsage({'names': ['keyCertSign','cRLSign']});
equal(o.tohex(), "300b0603551d0f040403020106", "name [certsign,crlsign]");
});

// CRLDP
Expand Down
7 changes: 4 additions & 3 deletions test/qunit-do-base64x.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,13 @@
var db = {
apple: 0,
banana: 3,
mango: 4,
kiwi: 8,
orange: 9
};
equal(namearraytobitstr(['apple'], db), '1', '> 1');
equal(namearraytobitstr(['apple','banana'], db), '1001', '> 1001');
equal(namearraytobitstr(['banana','kiwi','orange'], db), '1100001000', '> 1100001000');
equal(namearraytobinstr(['apple'], db), '1', '> 1');
equal(namearraytobinstr(['apple','banana','mango'], db), '10011', '> 10011');
equal(namearraytobinstr(['banana','kiwi','orange'], db), '0001000011', '> 0001000011');
});

});
Expand Down

0 comments on commit 2613c64

Please sign in to comment.