Skip to content

Commit

Permalink
10.5.10 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kjur committed Mar 10, 2022
1 parent 741b598 commit 2f7222e
Show file tree
Hide file tree
Showing 17 changed files with 920 additions and 899 deletions.
9 changes: 8 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@

ChangeLog for jsrsasign

hextoipv6 fix
* Changes from 10.5.9 to 10.5.10 (2022-Mar-10)
- src/base64x.js
- fix hextoipv6 for shrinking leading zeros (#536)
- test/qunit-do-base64x.html
- test case added for above updates.

small fix
* Changes from 10.5.8 to 10.5.9 version
* Changes from 10.5.8 to 10.5.9 (2022-Mar-10)
- src/base64x.js
- fix zulutosec (#538)
- src/asn1csr.js
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ gitadd: gitadd-all-doc gitadd-release
@echo done

rsync-test:
rsync -n -av api/ ../../_gitpg/jsrsasign/api
rsync -n -av --include="[a-z]*.js" --exclude="*" src/ ../../_gitpg/jsrsasign/src
rsync -n -av --include="[a-z]*.min.js" --exclude="*" min/ ../../_gitpg/jsrsasign/min
rsync -n -av --include="[a-z]*.html" --exclude="*" test/ ../../_gitpg/jsrsasign/test

rsync:
rsync -av api/ ../../_gitpg/jsrsasign/api
rsync -av --include="[a-z]*.js" --exclude="*" src/ ../../_gitpg/jsrsasign/src
rsync -av --include="[a-z]*.min.js" --exclude="*" min/ ../../_gitpg/jsrsasign/min
rsync -av --include="[a-z]*.html" --exclude="*" test/ ../../_gitpg/jsrsasign/test


bbb:

2 changes: 1 addition & 1 deletion api/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,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.9 base64x 1.1.22 (2022-Mar-10)</dd>
<dd>jsrsasign 10.5.10 base64x 1.1.23 (2022-Mar-10)</dd>



Expand Down
6 changes: 3 additions & 3 deletions api/symbols/global__.html
Original file line number Diff line number Diff line change
Expand Up @@ -2449,9 +2449,9 @@ <h1 class="classTitle">



<pre class="code">hextoip("871020010db8000000000000000000000004") &rarr "2001:db8::4"
hextoip("871020010db8000000000000000000") &rarr raise exception
hextoip("xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz") &rarr raise exception</pre>
<pre class="code">hextoipv6("871020010db8000000000000000000000004") &rarr "2001:db8::4"
hextoipv6("871020010db8000000000000000000") &rarr raise exception
hextoipv6("xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz") &rarr raise exception</pre>



Expand Down
1,676 changes: 839 additions & 837 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.9",
"version": "10.5.10",
"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
4 changes: 2 additions & 2 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.

4 changes: 2 additions & 2 deletions jsrsasign-rsa-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.

4 changes: 2 additions & 2 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.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 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.9",
"version": "10.5.10",
"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
60 changes: 31 additions & 29 deletions src/base64x-1.1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* base64x-1.1.22 (c) 2012-2022 Kenji Urushima | kjur.github.io/jsrsasign/license
/* base64x-1.1.23 (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 [email protected]
* @version jsrsasign 10.5.9 base64x 1.1.22 (2022-Mar-10)
* @version jsrsasign 10.5.10 base64x 1.1.23 (2022-Mar-10)
* @since jsrsasign 2.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
Expand Down Expand Up @@ -800,42 +800,44 @@ function ipv6tohex(s) {
* <a href="https://tools.ietf.org/html/rfc5952">RFC 5952</a>
* canonicalized IPv6 address string.
* @example
* hextoip("871020010db8000000000000000000000004") &rarr "2001:db8::4"
* hextoip("871020010db8000000000000000000") &rarr raise exception
* hextoip("xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz") &rarr raise exception
* hextoipv6("871020010db8000000000000000000000004") &rarr "2001:db8::4"
* hextoipv6("871020010db8000000000000000000") &rarr raise exception
* hextoipv6("xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz") &rarr raise exception
*/
function hextoipv6(s) {
if (! s.match(/^[0-9A-Fa-f]{32}$/))
throw "malformed IPv6 address octet";
if (! s.match(/^[0-9A-Fa-f]{32}$/))
throw new Error("malformed IPv6 address: " + s);

// 1. downcase
s = s.toLowerCase();
// 1. downcase
s = s.toLowerCase();

// 2. split 4
var a = s.match(/.{1,4}/g);
// 2. split 4 > ["0123", "00a4", "0000", ..., "ffff"]
var a = s.match(/.{1,4}/g);

// 3. trim leading 0
for (var i = 0; i < 8; i++) {
a[i] = a[i].replace(/^0+/, "");
if (a[i] == '') a[i] = '0';
}
s = ":" + a.join(":") + ":";
// 3. trim leading 0 for items and join > "123:a4:0:...:ffff"
a = a.map(function(s){s.replace(/^0+/, '')});
a = a.map(function(s){s == '' ? '0' : s});
s = ':' + a.join(':') + ':';

// 4. find shrinkables :0:0:...
var aZero = s.match(/:(0:){2,}/g);
// 4. find shrinkable candidates :0:0:..:0:
var aZero = s.match(/:(0:){2,}/g);

// 5. no shrinkable
if (aZero === null) return s.slice(1, -1);
// 5. no shrinkable
if (aZero == null) return s.slice(1, -1);

// 6. find max length :0:0:...
var item = '';
for (var i = 0; i < aZero.length; i++) {
if (aZero[i].length > item.length) item = aZero[i];
}
// 6. fix max length zero(:0:...:0:)
var sMaxZero = aZero.sort().slice(-1)[0];

// 7. replace shrinked
s = s.replace(sMaxZero.substr(0, sMaxZero.length - 1), ':');

// 8. trim leading ':' if not '::'
if (s.substr(0, 2) != '::') s = s.substr(1);

// 7. shrink
s = s.replace(item, '::');
return s.slice(1, -1);
// 9. trim tail ':' if not '::'
if (s.substr(-2, 2) != '::') s = s.substr(0, s.length - 1);

return s;
}

// ==== hex / ip =================================
Expand Down
28 changes: 17 additions & 11 deletions test/qunit-do-base64x.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,40 +234,46 @@
test("ipv6tohex", function() {
equal(ipv6tohex('2001:db8:0:1:0:1:9d6:8'),
'20010db8000000010000000109d60008',
'2001:db8:0:1:0:1:9d6:8');
'2001 0db8 0000 0001 0000 0001 09d6 0008 < 2001:db8:0:1:0:1:9d6:8');
equal(ipv6tohex('2001:db8::2:1'),
'20010db8000000000000000000020001',
'2001:db8::2:1');
'2001 0db8 0000 0000 0000 0000 0002 0001 < 2001:db8::2:1');
equal(ipv6tohex('2001:db8:0:1:1:0:1:1'),
'20010db8000000010001000000010001',
'2001:db8:0:1:1:0:1:1');
'2001 0db8 0000 0001 0001 0000 0001 0001 < 2001:db8:0:1:1:0:1:1');
equal(ipv6tohex('2001:0:0:1::1'),
'20010000000000010000000000000001',
'2001:0:0:1::1');
'2001 0000 0000 0001 0000 0000 0000 0001 < 2001:0:0:1::1');
equal(ipv6tohex('2001:DB8::ABCD:EF12'),
'20010db80000000000000000abcdef12',
'2001:DB8::ABCD:EF12');
'2001 0db8 0000 0000 0000 0000 abcd ef12 < 2001:DB8::ABCD:EF12');
});

test("hextoipv6", function() {
equal(hextoipv6('20010db8000000010000000109d60008'),
'2001:db8:0:1:0:1:9d6:8',
'2001:db8:0:1:0:1:9d6:8');
'2001 0db8 0000 0001 0000 0001 09d6 0008 > 2001:db8:0:1:0:1:9d6:8');
equal(hextoipv6('20010db8000000000000000000020001'),
'2001:db8::2:1',
'2001:db8::2:1');
'2001 0db8 0000 0000 0000 0000 0002 0001 > 2001:db8::2:1');
equal(hextoipv6('20010db8000000010001000000010001'),
'2001:db8:0:1:1:0:1:1',
'2001:db8:0:1:1:0:1:1');
'2001 0db8 0000 0001 0001 0000 0001 0001 > 2001:db8:0:1:1:0:1:1');
equal(hextoipv6('20010000000000010000000000000001'),
'2001:0:0:1::1',
'2001:0:0:1::1');
'2001 0000 0000 0001 0000 0000 0000 0001 > 2001:0:0:1::1');
equal(hextoipv6('20010db80000000000000000abcdef12'),
'2001:db8::abcd:ef12',
'2001:db8::abcd:ef12');
'2001 0db8 0000 0000 0000 0000 abcd ef12 > 2001:db8::abcd:ef12');
equal(hextoipv6('26064700470000000000000000001111'), // cloudflare 1.1.1.1
'2606:4700:4700::1111',
'cloudflare 2606:4700:4700::1111');
'2606 4700 4700 0000 0000 0000 0000 1111 > 2606:4700:4700::1111 cloudflare');
equal(hextoipv6('00000000000000000000ffff0ac6cbb1'), // issue 536
'::ffff:ac6:cbb1',
'0000 0000 0000 0000 0000 ffff 0ac6 cbb1 > ::ffff:ac6:cbb1')
equal(hextoipv6('ffff0ac6cbb100000000000000000000'),
'ffff:ac6:cbb1::',
'ffff 0ac6 cbb1 0000 0000 0000 0000 0000 > ffff:ac6:cbb1::')
});

test("hextoip", function() {
Expand Down

0 comments on commit 2f7222e

Please sign in to comment.