Skip to content

Commit c3c0312

Browse files
committed
release 1.2.0
1 parent f7a1ed2 commit c3c0312

22 files changed

+4502
-0
lines changed

Diff for: ChangeLog.txt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
ChangeLog for jsrsasig
3+
4+
* Changes between 1.1 and 1.2 [Apr 30, 2012]
5+
- fixed critial signature generation and verification bug related to
6+
zero padding of big integer.
7+
- add MD5, SHA512 and RIPEMD-160 support
8+
- default hash libraries were changed which was developed by
9+
Paul Johnston (See http://pajhome.org.uk/crypt/md5/md5.html).
10+
- now download site is hosted on github.
11+
12+
* Changes between 1.0 and 1.1 [Sep 25, 2010]
13+
- some web contents update
14+
15+
* 1.0 Initial Relasse [Jun 03, 2010]
16+
17+
18+

Diff for: LICENSE.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The 'jsrsasign'(RSA-Sign JavaScript Library) License
3+
4+
Copyright (c) 2010-2012 Kenji Urushima
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

Diff for: THIRDPARTY_LICENSE.txt

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
The 'RSA-Sign JavaScript Library' (jsrsasig) THRID PARTY LICENSE:
3+
4+
Apr 30, 2012
5+
6+
This document contains third party licensing information for
7+
the 'RSA-Sign JavaScript Library'. Where applicable,
8+
the text has not been edited from its original content or spelling.
9+
10+
*********************************************************
11+
For Tom Wu's jsbn library - BigInteger and RSA
12+
13+
base64.js - String encoder for Base64 and Hex
14+
jsbn.js - basic BigInteger class
15+
jsbn2.js - BigInteger class extension
16+
prng4.js - Random number generator
17+
rng.js - Random number generator
18+
rsa.js - RSAKey class for RSA public key encryption.
19+
rsa2.js - RSA class extension for RSA private key decryption.
20+
21+
http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
22+
23+
*********************************************************
24+
25+
Licensing
26+
---------
27+
28+
This software is covered under the following copyright:
29+
30+
/*
31+
* Copyright (c) 2003-2005 Tom Wu
32+
* All Rights Reserved.
33+
*
34+
* Permission is hereby granted, free of charge, to any person obtaining
35+
* a copy of this software and associated documentation files (the
36+
* "Software"), to deal in the Software without restriction, including
37+
* without limitation the rights to use, copy, modify, merge, publish,
38+
* distribute, sublicense, and/or sell copies of the Software, and to
39+
* permit persons to whom the Software is furnished to do so, subject to
40+
* the following conditions:
41+
*
42+
* The above copyright notice and this permission notice shall be
43+
* included in all copies or substantial portions of the Software.
44+
*
45+
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
46+
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
47+
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
48+
*
49+
* IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
50+
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
51+
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
52+
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
53+
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
54+
*
55+
* In addition, the following condition applies:
56+
*
57+
* All redistributions must retain an intact copy of this copyright notice
58+
* and disclaimer.
59+
*/
60+
61+
Address all questions regarding this license to:
62+
63+
Tom Wu
64+
65+
66+
67+
*********************************************************
68+
For Paul Johnston's Hash Algorithm JavaScript
69+
70+
sha1.js - SHA1 hash algorithm
71+
sha256.js - SHA256 hash algorithm
72+
sha512.js - SHA512 hash algorithm
73+
md5.js - MD5 hash algorithm
74+
ripemd160.js - RIPEMD-160 hash algorithm
75+
76+
http://pajhome.org.uk/site/legal.html#bsdlicense
77+
78+
*********************************************************
79+
80+
The BSD License
81+
82+
Copyright (c) 1998 - 2009, Paul Johnston & Contributors
83+
All rights reserved.
84+
85+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
86+
87+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
88+
89+
Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
90+
91+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
92+

Diff for: asn1hex.js

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
//
2+
// asn1hex.js - Hexadecimal represented ASN.1 string library
3+
//
4+
//
5+
// version: 1.0 (2010-Jun-03)
6+
//
7+
// Copyright (c) 2010 Kenji Urushima ([email protected])
8+
//
9+
// This software is licensed under the terms of the MIT License.
10+
// http://www.opensource.org/licenses/mit-license.php
11+
//
12+
// The above copyright and license notice shall be
13+
// included in all copies or substantial portions of the Software.
14+
//
15+
//
16+
// Depends on:
17+
//
18+
19+
// MEMO:
20+
// f('3082025b02...', 2) ... 82025b ... 3bytes
21+
// f('020100', 2) ... 01 ... 1byte
22+
// f('0203001...', 2) ... 03 ... 1byte
23+
// f('02818003...', 2) ... 8180 ... 2bytes
24+
// f('3080....0000', 2) ... 80 ... -1
25+
//
26+
// Requirements:
27+
// - ASN.1 type octet length MUST be 1.
28+
// (i.e. ASN.1 primitives like SET, SEQUENCE, INTEGER, OCTETSTRING ...)
29+
// -
30+
function _asnhex_getByteLengthOfL_AtObj(s, pos) {
31+
if (s.substring(pos + 2, pos + 3) != '8') return 1;
32+
var i = parseInt(s.substring(pos + 3, pos + 4));
33+
if (i == 0) return -1; // length octet '80' indefinite length
34+
if (0 < i && i < 10) return i + 1; // including '8?' octet;
35+
return -2; // malformed format
36+
}
37+
38+
function _asnhex_getHexOfL_AtObj(s, pos) {
39+
var len = _asnhex_getByteLengthOfL_AtObj(s, pos);
40+
if (len < 1) return '';
41+
return s.substring(pos + 2, pos + 2 + len * 2);
42+
}
43+
44+
//
45+
// getting ASN.1 length value at the position 'idx' of
46+
// hexa decimal string 's'.
47+
//
48+
// f('3082025b02...', 0) ... 82025b ... ???
49+
// f('020100', 0) ... 01 ... 1
50+
// f('0203001...', 0) ... 03 ... 3
51+
// f('02818003...', 0) ... 8180 ... 128
52+
function _asnhex_getIntOfL_AtObj(s, pos) {
53+
var hLength = _asnhex_getHexOfL_AtObj(s, pos);
54+
if (hLength == '') return -1;
55+
var bi;
56+
if (parseInt(hLength.substring(0, 1)) < 8) {
57+
bi = parseBigInt(hLength, 16);
58+
} else {
59+
bi = parseBigInt(hLength.substring(2), 16);
60+
}
61+
return bi.intValue();
62+
}
63+
64+
//
65+
// get ASN.1 value starting string position
66+
// for ASN.1 object refered by index 'idx'.
67+
//
68+
function _asnhex_getStartPosOfV_AtObj(s, pos) {
69+
var l_len = _asnhex_getByteLengthOfL_AtObj(s, pos);
70+
if (l_len < 0) return l_len;
71+
return pos + (l_len + 1) * 2;
72+
}
73+
74+
function _asnhex_getHexOfV_AtObj(s, pos) {
75+
var pos1 = _asnhex_getStartPosOfV_AtObj(s, pos);
76+
var len = _asnhex_getIntOfL_AtObj(s, pos);
77+
return s.substring(pos1, pos1 + len * 2);
78+
}
79+
80+
function _asnhex_getPosOfNextSibling_AtObj(s, pos) {
81+
var pos1 = _asnhex_getStartPosOfV_AtObj(s, pos);
82+
var len = _asnhex_getIntOfL_AtObj(s, pos);
83+
return pos1 + len * 2;
84+
}
85+
86+
function _asnhex_getPosArrayOfChildren_AtObj(h, pos) {
87+
var a = new Array();
88+
var p0 = _asnhex_getStartPosOfV_AtObj(h, pos);
89+
a.push(p0);
90+
91+
var len = _asnhex_getIntOfL_AtObj(h, pos);
92+
var p = p0;
93+
var k = 0;
94+
while (1) {
95+
var pNext = _asnhex_getPosOfNextSibling_AtObj(h, p);
96+
if (pNext == null || (pNext - p0 >= (len * 2))) break;
97+
if (k >= 200) break;
98+
99+
a.push(pNext);
100+
p = pNext;
101+
102+
k++;
103+
}
104+
105+
return a;
106+
}

Diff for: base64.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2+
var b64pad="=";
3+
4+
function hex2b64(h) {
5+
var i;
6+
var c;
7+
var ret = "";
8+
for(i = 0; i+3 <= h.length; i+=3) {
9+
c = parseInt(h.substring(i,i+3),16);
10+
ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);
11+
}
12+
if(i+1 == h.length) {
13+
c = parseInt(h.substring(i,i+1),16);
14+
ret += b64map.charAt(c << 2);
15+
}
16+
else if(i+2 == h.length) {
17+
c = parseInt(h.substring(i,i+2),16);
18+
ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);
19+
}
20+
while((ret.length & 3) > 0) ret += b64pad;
21+
return ret;
22+
}
23+
24+
// convert a base64 string to hex
25+
function b64tohex(s) {
26+
var ret = ""
27+
var i;
28+
var k = 0; // b64 state, 0-3
29+
var slop;
30+
for(i = 0; i < s.length; ++i) {
31+
if(s.charAt(i) == b64pad) break;
32+
v = b64map.indexOf(s.charAt(i));
33+
if(v < 0) continue;
34+
if(k == 0) {
35+
ret += int2char(v >> 2);
36+
slop = v & 3;
37+
k = 1;
38+
}
39+
else if(k == 1) {
40+
ret += int2char((slop << 2) | (v >> 4));
41+
slop = v & 0xf;
42+
k = 2;
43+
}
44+
else if(k == 2) {
45+
ret += int2char(slop);
46+
ret += int2char(v >> 2);
47+
slop = v & 3;
48+
k = 3;
49+
}
50+
else {
51+
ret += int2char((slop << 2) | (v >> 4));
52+
ret += int2char(v & 0xf);
53+
k = 0;
54+
}
55+
}
56+
if(k == 1)
57+
ret += int2char(slop << 2);
58+
return ret;
59+
}
60+
61+
// convert a base64 string to a byte/number array
62+
function b64toBA(s) {
63+
//piggyback on b64tohex for now, optimize later
64+
var h = b64tohex(s);
65+
var i;
66+
var a = new Array();
67+
for(i = 0; 2*i < h.length; ++i) {
68+
a[i] = parseInt(h.substring(2*i,2*i+2),16);
69+
}
70+
return a;
71+
}

0 commit comments

Comments
 (0)