Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/AES.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/Base.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/BigInt.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/PRNG.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/RSA.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/SHA.js | 15 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/SRP.js | 15 |
13 files changed, 78 insertions, 117 deletions
diff --git a/frontend/gamma/js/Clipperz/Crypto/AES.js b/frontend/gamma/js/Clipperz/Crypto/AES.js index 36fc731..c811f1c 100644 --- a/frontend/gamma/js/Clipperz/Crypto/AES.js +++ b/frontend/gamma/js/Clipperz/Crypto/AES.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; | 27 | throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | //Dependency commented to avoid a circular reference | 30 | //Dependency commented to avoid a circular reference |
34 | //try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { | 31 | //try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { |
35 | //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!"; | 32 | //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!"; |
36 | //} | 33 | //} |
37 | 34 | ||
38 | if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; } | 35 | if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; } |
39 | 36 | ||
40 | //############################################################################# | 37 | //############################################################################# |
41 | 38 | ||
42 | Clipperz.Crypto.AES.DeferredExecutionContext = function(args) { | 39 | Clipperz.Crypto.AES.DeferredExecutionContext = function(args) { |
43 | args = args || {}; | 40 | args = args || {}; |
44 | 41 | ||
45 | this._key = args.key; | 42 | this._key = args.key; |
46 | this._message = args.message; | 43 | this._message = args.message; |
47 | this._result = args.message.clone(); | 44 | this._result = args.message.clone(); |
48 | this._nonce = args.nonce; | 45 | this._nonce = args.nonce; |
49 | this._messageLength = this._message.length(); | 46 | this._messageLength = this._message.length(); |
50 | 47 | ||
51 | this._messageArray = this._message.arrayValues(); | 48 | this._messageArray = this._message.arrayValues(); |
52 | this._resultArray = this._result.arrayValues(); | 49 | this._resultArray = this._result.arrayValues(); |
53 | this._nonceArray = this._nonce.arrayValues(); | 50 | this._nonceArray = this._nonce.arrayValues(); |
54 | 51 | ||
55 | this._executionStep = 0; | 52 | this._executionStep = 0; |
56 | 53 | ||
57 | // this._elaborationChunkSize = 1024; // 4096; // 16384; //4096; | 54 | // this._elaborationChunkSize = 1024; // 4096; // 16384; //4096; |
58 | this._elaborationChunks = 10; | 55 | this._elaborationChunks = 10; |
59 | this._pauseTime = 0.02; // 0.02 //0.2; | 56 | this._pauseTime = 0.02; // 0.02 //0.2; |
60 | 57 | ||
61 | return this; | 58 | return this; |
62 | } | 59 | } |
63 | 60 | ||
64 | Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, { | 61 | Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, { |
65 | 62 | ||
66 | 'key': function() { | 63 | 'key': function() { |
67 | return this._key; | 64 | return this._key; |
68 | }, | 65 | }, |
69 | 66 | ||
70 | 'message': function() { | 67 | 'message': function() { |
71 | return this._message; | 68 | return this._message; |
72 | }, | 69 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/Base.js b/frontend/gamma/js/Clipperz/Crypto/Base.js index b69dcc8..d3a8e36 100644 --- a/frontend/gamma/js/Clipperz/Crypto/Base.js +++ b/frontend/gamma/js/Clipperz/Crypto/Base.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; | 27 | throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
34 | if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; } | 31 | if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; } |
35 | 32 | ||
36 | Clipperz.Crypto.Base.VERSION = "0.1"; | 33 | Clipperz.Crypto.Base.VERSION = "0.1"; |
37 | Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base"; | 34 | Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base"; |
38 | 35 | ||
39 | //############################################################################# | 36 | //############################################################################# |
40 | //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js) | 37 | //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js) |
41 | //############################################################################# | 38 | //############################################################################# |
42 | 39 | ||
43 | /* A JavaScript implementation of the Secure Hash Algorithm, SHA-256 | 40 | /* A JavaScript implementation of the Secure Hash Algorithm, SHA-256 |
44 | * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/ | 41 | * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/ |
45 | * Distributed under the BSD License | 42 | * Distributed under the BSD License |
46 | * Some bits taken from Paul Johnston's SHA-1 implementation | 43 | * Some bits taken from Paul Johnston's SHA-1 implementation |
47 | */ | 44 | */ |
48 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | 45 | var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ |
49 | function safe_add (x, y) { | 46 | function safe_add (x, y) { |
50 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); | 47 | var lsw = (x & 0xFFFF) + (y & 0xFFFF); |
51 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | 48 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); |
52 | return (msw << 16) | (lsw & 0xFFFF); | 49 | return (msw << 16) | (lsw & 0xFFFF); |
53 | } | 50 | } |
54 | function S (X, n) {return ( X >>> n ) | (X << (32 - n));} | 51 | function S (X, n) {return ( X >>> n ) | (X << (32 - n));} |
55 | function R (X, n) {return ( X >>> n );} | 52 | function R (X, n) {return ( X >>> n );} |
56 | function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));} | 53 | function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));} |
57 | function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));} | 54 | function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));} |
58 | function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));} | 55 | function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));} |
59 | function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));} | 56 | function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));} |
60 | function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));} | 57 | function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));} |
61 | function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));} | 58 | function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));} |
62 | function core_sha256 (m, l) { | 59 | function core_sha256 (m, l) { |
63 | var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2); | 60 | var K = new Array(0x428A2F98,0x71374491,0xB5C0FBCF,0xE9B5DBA5,0x3956C25B,0x59F111F1,0x923F82A4,0xAB1C5ED5,0xD807AA98,0x12835B01,0x243185BE,0x550C7DC3,0x72BE5D74,0x80DEB1FE,0x9BDC06A7,0xC19BF174,0xE49B69C1,0xEFBE4786,0xFC19DC6,0x240CA1CC,0x2DE92C6F,0x4A7484AA,0x5CB0A9DC,0x76F988DA,0x983E5152,0xA831C66D,0xB00327C8,0xBF597FC7,0xC6E00BF3,0xD5A79147,0x6CA6351,0x14292967,0x27B70A85,0x2E1B2138,0x4D2C6DFC,0x53380D13,0x650A7354,0x766A0ABB,0x81C2C92E,0x92722C85,0xA2BFE8A1,0xA81A664B,0xC24B8B70,0xC76C51A3,0xD192E819,0xD6990624,0xF40E3585,0x106AA070,0x19A4C116,0x1E376C08,0x2748774C,0x34B0BCB5,0x391C0CB3,0x4ED8AA4A,0x5B9CCA4F,0x682E6FF3,0x748F82EE,0x78A5636F,0x84C87814,0x8CC70208,0x90BEFFFA,0xA4506CEB,0xBEF9A3F7,0xC67178F2); |
64 | var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); | 61 | var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); |
65 | var W = new Array(64); | 62 | var W = new Array(64); |
66 | var a, b, c, d, e, f, g, h, i, j; | 63 | var a, b, c, d, e, f, g, h, i, j; |
67 | var T1, T2; | 64 | var T1, T2; |
68 | /* append padding */ | 65 | /* append padding */ |
69 | m[l >> 5] |= 0x80 << (24 - l % 32); | 66 | m[l >> 5] |= 0x80 << (24 - l % 32); |
70 | m[((l + 64 >> 9) << 4) + 15] = l; | 67 | m[((l + 64 >> 9) << 4) + 15] = l; |
71 | for ( var i = 0; i<m.length; i+=16 ) { | 68 | for ( var i = 0; i<m.length; i+=16 ) { |
72 | a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; | 69 | a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; |
diff --git a/frontend/gamma/js/Clipperz/Crypto/BigInt.js b/frontend/gamma/js/Clipperz/Crypto/BigInt.js index d4d05d2..41483a3 100644 --- a/frontend/gamma/js/Clipperz/Crypto/BigInt.js +++ b/frontend/gamma/js/Clipperz/Crypto/BigInt.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 27 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
31 | 28 | ||
32 | //############################################################################# | 29 | //############################################################################# |
33 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js | 30 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js |
34 | //############################################################################# | 31 | //############################################################################# |
35 | 32 | ||
36 | 33 | ||
37 | //////////////////////////////////////////////////////////////////////////////////////// | 34 | //////////////////////////////////////////////////////////////////////////////////////// |
38 | // Big Integer Library v. 5.0 | 35 | // Big Integer Library v. 5.0 |
39 | // Created 2000, last modified 2006 | 36 | // Created 2000, last modified 2006 |
40 | // Leemon Baird | 37 | // Leemon Baird |
41 | // www.leemon.com | 38 | // www.leemon.com |
42 | // | 39 | // |
43 | // This file is public domain. You can use it for any purpose without restriction. | 40 | // This file is public domain. You can use it for any purpose without restriction. |
44 | // I do not guarantee that it is correct, so use it at your own risk. If you use | 41 | // I do not guarantee that it is correct, so use it at your own risk. If you use |
45 | // it for something interesting, I'd appreciate hearing about it. If you find | 42 | // it for something interesting, I'd appreciate hearing about it. If you find |
46 | // any bugs or make any improvements, I'd appreciate hearing about those too. | 43 | // any bugs or make any improvements, I'd appreciate hearing about those too. |
47 | // It would also be nice if my name and address were left in the comments. | 44 | // It would also be nice if my name and address were left in the comments. |
48 | // But none of that is required. | 45 | // But none of that is required. |
49 | // | 46 | // |
50 | // This code defines a bigInt library for arbitrary-precision integers. | 47 | // This code defines a bigInt library for arbitrary-precision integers. |
51 | // A bigInt is an array of integers storing the value in chunks of bpe bits, | 48 | // A bigInt is an array of integers storing the value in chunks of bpe bits, |
52 | // little endian (buff[0] is the least significant word). | 49 | // little endian (buff[0] is the least significant word). |
53 | // Negative bigInts are stored two's complement. | 50 | // Negative bigInts are stored two's complement. |
54 | // Some functions assume their parameters have at least one leading zero element. | 51 | // Some functions assume their parameters have at least one leading zero element. |
55 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, | 52 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, |
56 | // so the caller must make sure overflow won't happen. | 53 | // so the caller must make sure overflow won't happen. |
57 | // For each function where a parameter is modified, that same | 54 | // For each function where a parameter is modified, that same |
58 | // variable must not be used as another argument too. | 55 | // variable must not be used as another argument too. |
59 | // So, you cannot square x by doing multMod_(x,x,n). | 56 | // So, you cannot square x by doing multMod_(x,x,n). |
60 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). | 57 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). |
61 | // | 58 | // |
62 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. | 59 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. |
63 | // For most functions, if it needs a BigInt as a local variable it will actually use | 60 | // For most functions, if it needs a BigInt as a local variable it will actually use |
64 | // a global, and will only allocate to it when it's not the right size. This ensures | 61 | // a global, and will only allocate to it when it's not the right size. This ensures |
65 | // that when a function is called repeatedly with same-sized parameters, it only allocates | 62 | // that when a function is called repeatedly with same-sized parameters, it only allocates |
66 | // memory on the first call. | 63 | // memory on the first call. |
67 | // | 64 | // |
68 | // Note that for cryptographic purposes, the calls to Math.random() must | 65 | // Note that for cryptographic purposes, the calls to Math.random() must |
69 | // be replaced with calls to a better pseudorandom number generator. | 66 | // be replaced with calls to a better pseudorandom number generator. |
70 | // | 67 | // |
71 | // In the following, "bigInt" means a bigInt with at least one leading zero element, | 68 | // In the following, "bigInt" means a bigInt with at least one leading zero element, |
72 | // and "integer" means a nonnegative integer less than radix. In some cases, integer | 69 | // and "integer" means a nonnegative integer less than radix. In some cases, integer |
diff --git a/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js b/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js index e91e823..f91c7e9 100644 --- a/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js +++ b/frontend/gamma/js/Clipperz/Crypto/BigInt_scoped.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 27 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
31 | 28 | ||
32 | if (typeof(Leemon) == 'undefined') { Leemon = {}; } | 29 | if (typeof(Leemon) == 'undefined') { Leemon = {}; } |
33 | if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } | 30 | if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } |
34 | if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; } | 31 | if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; } |
35 | 32 | ||
36 | 33 | ||
37 | //############################################################################# | 34 | //############################################################################# |
38 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js | 35 | //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js |
39 | //############################################################################# | 36 | //############################################################################# |
40 | 37 | ||
41 | //////////////////////////////////////////////////////////////////////////////////////// | 38 | //////////////////////////////////////////////////////////////////////////////////////// |
42 | // Big Integer Library v. 5.0 | 39 | // Big Integer Library v. 5.0 |
43 | // Created 2000, last modified 2006 | 40 | // Created 2000, last modified 2006 |
44 | // Leemon Baird | 41 | // Leemon Baird |
45 | // www.leemon.com | 42 | // www.leemon.com |
46 | // | 43 | // |
47 | // This file is public domain. You can use it for any purpose without restriction. | 44 | // This file is public domain. You can use it for any purpose without restriction. |
48 | // I do not guarantee that it is correct, so use it at your own risk. If you use | 45 | // I do not guarantee that it is correct, so use it at your own risk. If you use |
49 | // it for something interesting, I'd appreciate hearing about it. If you find | 46 | // it for something interesting, I'd appreciate hearing about it. If you find |
50 | // any bugs or make any improvements, I'd appreciate hearing about those too. | 47 | // any bugs or make any improvements, I'd appreciate hearing about those too. |
51 | // It would also be nice if my name and address were left in the comments. | 48 | // It would also be nice if my name and address were left in the comments. |
52 | // But none of that is required. | 49 | // But none of that is required. |
53 | // | 50 | // |
54 | // This code defines a bigInt library for arbitrary-precision integers. | 51 | // This code defines a bigInt library for arbitrary-precision integers. |
55 | // A bigInt is an array of integers storing the value in chunks of bpe bits, | 52 | // A bigInt is an array of integers storing the value in chunks of bpe bits, |
56 | // little endian (buff[0] is the least significant word). | 53 | // little endian (buff[0] is the least significant word). |
57 | // Negative bigInts are stored two's complement. | 54 | // Negative bigInts are stored two's complement. |
58 | // Some functions assume their parameters have at least one leading zero element. | 55 | // Some functions assume their parameters have at least one leading zero element. |
59 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, | 56 | // Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, |
60 | // so the caller must make sure overflow won't happen. | 57 | // so the caller must make sure overflow won't happen. |
61 | // For each function where a parameter is modified, that same | 58 | // For each function where a parameter is modified, that same |
62 | // variable must not be used as another argument too. | 59 | // variable must not be used as another argument too. |
63 | // So, you cannot square x by doing multMod_(x,x,n). | 60 | // So, you cannot square x by doing multMod_(x,x,n). |
64 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). | 61 | // You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). |
65 | // | 62 | // |
66 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. | 63 | // These functions are designed to avoid frequent dynamic memory allocation in the inner loop. |
67 | // For most functions, if it needs a BigInt as a local variable it will actually use | 64 | // For most functions, if it needs a BigInt as a local variable it will actually use |
68 | // a global, and will only allocate to it when it's not the right size. This ensures | 65 | // a global, and will only allocate to it when it's not the right size. This ensures |
69 | // that when a function is called repeatedly with same-sized parameters, it only allocates | 66 | // that when a function is called repeatedly with same-sized parameters, it only allocates |
70 | // memory on the first call. | 67 | // memory on the first call. |
71 | // | 68 | // |
72 | // Note that for cryptographic purposes, the calls to Math.random() must | 69 | // Note that for cryptographic purposes, the calls to Math.random() must |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js index 2033eb4..19f19c2 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
31 | //} | 28 | //} |
32 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
33 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
34 | 31 | ||
35 | Clipperz.Crypto.ECC.BinaryField.Curve = function(args) { | 32 | Clipperz.Crypto.ECC.BinaryField.Curve = function(args) { |
36 | args = args || {}; | 33 | args = args || {}; |
37 | 34 | ||
38 | this._modulus = args.modulus; | 35 | this._modulus = args.modulus; |
39 | 36 | ||
40 | this._a = args.a; | 37 | this._a = args.a; |
41 | this._b = args.b; | 38 | this._b = args.b; |
42 | this._G = args.G; | 39 | this._G = args.G; |
43 | this._r = args.r; | 40 | this._r = args.r; |
44 | this._h = args.h; | 41 | this._h = args.h; |
45 | 42 | ||
46 | this._finiteField = null; | 43 | this._finiteField = null; |
47 | 44 | ||
48 | return this; | 45 | return this; |
49 | } | 46 | } |
50 | 47 | ||
51 | Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | 48 | Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { |
52 | 49 | ||
53 | 'asString': function() { | 50 | 'asString': function() { |
54 | return "Clipperz.Crypto.ECC.BinaryField.Curve"; | 51 | return "Clipperz.Crypto.ECC.BinaryField.Curve"; |
55 | }, | 52 | }, |
56 | 53 | ||
57 | //----------------------------------------------------------------------------- | 54 | //----------------------------------------------------------------------------- |
58 | 55 | ||
59 | 'modulus': function() { | 56 | 'modulus': function() { |
60 | return this._modulus; | 57 | return this._modulus; |
61 | }, | 58 | }, |
62 | 59 | ||
63 | 'a': function() { | 60 | 'a': function() { |
64 | return this._a; | 61 | return this._a; |
65 | }, | 62 | }, |
66 | 63 | ||
67 | 'b': function() { | 64 | 'b': function() { |
68 | return this._b; | 65 | return this._b; |
69 | }, | 66 | }, |
70 | 67 | ||
71 | 'G': function() { | 68 | 'G': function() { |
72 | return this._G; | 69 | return this._G; |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js index a649c9f..56f257a 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
31 | //} | 28 | //} |
32 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
33 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
34 | 31 | ||
35 | Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) { | 32 | Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) { |
36 | args = args || {}; | 33 | args = args || {}; |
37 | this._modulus = args.modulus; | 34 | this._modulus = args.modulus; |
38 | 35 | ||
39 | return this; | 36 | return this; |
40 | } | 37 | } |
41 | 38 | ||
42 | Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, { | 39 | Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, { |
43 | 40 | ||
44 | 'asString': function() { | 41 | 'asString': function() { |
45 | return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")"; | 42 | return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")"; |
46 | }, | 43 | }, |
47 | 44 | ||
48 | //----------------------------------------------------------------------------- | 45 | //----------------------------------------------------------------------------- |
49 | 46 | ||
50 | 'modulus': function() { | 47 | 'modulus': function() { |
51 | return this._modulus; | 48 | return this._modulus; |
52 | }, | 49 | }, |
53 | 50 | ||
54 | //----------------------------------------------------------------------------- | 51 | //----------------------------------------------------------------------------- |
55 | 52 | ||
56 | '_module': function(aValue) { | 53 | '_module': function(aValue) { |
57 | varresult; | 54 | varresult; |
58 | var modulusComparison; | 55 | var modulusComparison; |
59 | //console.log(">>> binaryField.finiteField.(standard)module"); | 56 | //console.log(">>> binaryField.finiteField.(standard)module"); |
60 | 57 | ||
61 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); | 58 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); |
62 | 59 | ||
63 | if (modulusComparison < 0) { | 60 | if (modulusComparison < 0) { |
64 | result = aValue; | 61 | result = aValue; |
65 | } else if (modulusComparison == 0) { | 62 | } else if (modulusComparison == 0) { |
66 | result = [0]; | 63 | result = [0]; |
67 | } else { | 64 | } else { |
68 | var modulusBitSize; | 65 | var modulusBitSize; |
69 | var resultBitSize; | 66 | var resultBitSize; |
70 | 67 | ||
71 | result = aValue; | 68 | result = aValue; |
72 | 69 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js index b7a5537..ffe287b 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js | |||
@@ -1,67 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
31 | //} | 28 | //} |
32 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 29 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
33 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 30 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
34 | 31 | ||
35 | Clipperz.Crypto.ECC.BinaryField.Point = function(args) { | 32 | Clipperz.Crypto.ECC.BinaryField.Point = function(args) { |
36 | args = args || {}; | 33 | args = args || {}; |
37 | this._x = args.x; | 34 | this._x = args.x; |
38 | this._y = args.y; | 35 | this._y = args.y; |
39 | 36 | ||
40 | return this; | 37 | return this; |
41 | } | 38 | } |
42 | 39 | ||
43 | Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, { | 40 | Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, { |
44 | 41 | ||
45 | 'asString': function() { | 42 | 'asString': function() { |
46 | return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")"; | 43 | return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")"; |
47 | }, | 44 | }, |
48 | 45 | ||
49 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
50 | 47 | ||
51 | 'x': function() { | 48 | 'x': function() { |
52 | return this._x; | 49 | return this._x; |
53 | }, | 50 | }, |
54 | 51 | ||
55 | 'y': function() { | 52 | 'y': function() { |
56 | return this._y; | 53 | return this._y; |
57 | }, | 54 | }, |
58 | 55 | ||
59 | //----------------------------------------------------------------------------- | 56 | //----------------------------------------------------------------------------- |
60 | 57 | ||
61 | 'isZero': function() { | 58 | 'isZero': function() { |
62 | return (this.x().isZero() && this.y().isZero()) | 59 | return (this.x().isZero() && this.y().isZero()) |
63 | }, | 60 | }, |
64 | 61 | ||
65 | //----------------------------------------------------------------------------- | 62 | //----------------------------------------------------------------------------- |
66 | __syntaxFix__: "syntax fix" | 63 | __syntaxFix__: "syntax fix" |
67 | }); | 64 | }); |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js index 5a430d1..b705a20 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | //try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; | 27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
31 | //} | 28 | //} |
32 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 29 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
33 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
34 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } | 31 | if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } |
35 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } | 32 | if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } |
36 | 33 | ||
37 | Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase, aBitSize) { | 34 | Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase, aBitSize) { |
38 | if (aValue.constructor == String) { | 35 | if (aValue.constructor == String) { |
39 | varvalue; | 36 | varvalue; |
40 | varstringLength; | 37 | varstringLength; |
41 | var numberOfWords; | 38 | var numberOfWords; |
42 | vari,c; | 39 | vari,c; |
43 | 40 | ||
44 | if (aBase != 16) { | 41 | if (aBase != 16) { |
45 | throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase; | 42 | throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase; |
46 | } | 43 | } |
47 | 44 | ||
48 | value = aValue.replace(/ /g, ''); | 45 | value = aValue.replace(/ /g, ''); |
49 | stringLength = value.length; | 46 | stringLength = value.length; |
50 | numberOfWords = Math.ceil(stringLength / 8); | 47 | numberOfWords = Math.ceil(stringLength / 8); |
51 | this._value = new Array(numberOfWords); | 48 | this._value = new Array(numberOfWords); |
52 | 49 | ||
53 | c = numberOfWords; | 50 | c = numberOfWords; |
54 | for (i=0; i<c; i++) { | 51 | for (i=0; i<c; i++) { |
55 | varword; | 52 | varword; |
56 | 53 | ||
57 | if (i < (c-1)) { | 54 | if (i < (c-1)) { |
58 | word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16); | 55 | word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16); |
59 | } else { | 56 | } else { |
60 | word = parseInt(value.substr(0, stringLength-(i*8)), 16); | 57 | word = parseInt(value.substr(0, stringLength-(i*8)), 16); |
61 | } | 58 | } |
62 | 59 | ||
63 | this._value[i] = word; | 60 | this._value[i] = word; |
64 | } | 61 | } |
65 | } else if (aValue.constructor == Array) { | 62 | } else if (aValue.constructor == Array) { |
66 | var itemsToCopy; | 63 | var itemsToCopy; |
67 | 64 | ||
68 | itemsToCopy = aValue.length; | 65 | itemsToCopy = aValue.length; |
69 | while (aValue[itemsToCopy - 1] == 0) { | 66 | while (aValue[itemsToCopy - 1] == 0) { |
70 | itemsToCopy --; | 67 | itemsToCopy --; |
71 | } | 68 | } |
72 | 69 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js index ae2b8fb..be197e3 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { | 26 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { |
30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; | 27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; |
31 | //} | 28 | //} |
32 | //try { if (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) == 'undefined') { throw ""; }} catch (e) { | 29 | //try { if (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) == 'undefined') { throw ""; }} catch (e) { |
33 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.Koblitz.Curve!"; | 30 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.Koblitz.Curve!"; |
34 | //} | 31 | //} |
35 | 32 | ||
36 | Clipperz.Crypto.ECC.StandardCurves = {}; | 33 | Clipperz.Crypto.ECC.StandardCurves = {}; |
37 | 34 | ||
38 | MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | 35 | MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { |
39 | 36 | ||
40 | //============================================================================== | 37 | //============================================================================== |
41 | 38 | ||
42 | '_K571': null, | 39 | '_K571': null, |
43 | 'K571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1 | 40 | 'K571': function() { //f(z) = z^571 + z^10 + z^5 + z^2 + 1 |
44 | if ((Clipperz.Crypto.ECC.StandardCurves._K571 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { | 41 | if ((Clipperz.Crypto.ECC.StandardCurves._K571 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { |
45 | Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.Koblitz.Curve({ | 42 | Clipperz.Crypto.ECC.StandardCurves._K571 = new Clipperz.Crypto.ECC.Koblitz.Curve({ |
46 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000425', 16), | 43 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000425', 16), |
47 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), | 44 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), |
48 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), | 45 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), |
49 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ | 46 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ |
50 | x: new Clipperz.Crypto.ECC.Koblitz.Value('026eb7a8 59923fbc 82189631 f8103fe4 ac9ca297 0012d5d4 60248048 01841ca4 43709584 93b205e6 47da304d b4ceb08c bbd1ba39 494776fb 988b4717 4dca88c7 e2945283 a01c8972', 16), | 47 | x: new Clipperz.Crypto.ECC.Koblitz.Value('026eb7a8 59923fbc 82189631 f8103fe4 ac9ca297 0012d5d4 60248048 01841ca4 43709584 93b205e6 47da304d b4ceb08c bbd1ba39 494776fb 988b4717 4dca88c7 e2945283 a01c8972', 16), |
51 | y: new Clipperz.Crypto.ECC.Koblitz.Value('0349dc80 7f4fbf37 4f4aeade 3bca9531 4dd58cec 9f307a54 ffc61efc 006d8a2c 9d4979c0 ac44aea7 4fbebbb9 f772aedc b620b01a 7ba7af1b 320430c8 591984f6 01cd4c14 3ef1c7a3', 16) | 48 | y: new Clipperz.Crypto.ECC.Koblitz.Value('0349dc80 7f4fbf37 4f4aeade 3bca9531 4dd58cec 9f307a54 ffc61efc 006d8a2c 9d4979c0 ac44aea7 4fbebbb9 f772aedc b620b01a 7ba7af1b 320430c8 591984f6 01cd4c14 3ef1c7a3', 16) |
52 | }), | 49 | }), |
53 | r: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16), | 50 | r: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16), |
54 | h: new Clipperz.Crypto.ECC.Koblitz.Value('4', 16), | 51 | h: new Clipperz.Crypto.ECC.Koblitz.Value('4', 16), |
55 | primeFactor: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16) | 52 | primeFactor: new Clipperz.Crypto.ECC.Koblitz.Value('02000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 131850e1 f19a63e4 b391a8db 917f4138 b630d84b e5d63938 1e91deb4 5cfe778f 637c1001', 16) |
56 | }); | 53 | }); |
57 | } | 54 | } |
58 | 55 | ||
59 | return Clipperz.Crypto.ECC.StandardCurves._K571; | 56 | return Clipperz.Crypto.ECC.StandardCurves._K571; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //----------------------------------------------------------------------------- | 59 | //----------------------------------------------------------------------------- |
63 | 60 | ||
64 | '_K283': null, | 61 | '_K283': null, |
65 | 'K283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 | 62 | 'K283': function() { //f(z) = z^283 + z^12 + z^7 + z^5 + 1 |
66 | if ((Clipperz.Crypto.ECC.StandardCurves._K283 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { | 63 | if ((Clipperz.Crypto.ECC.StandardCurves._K283 == null) && (typeof(Clipperz.Crypto.ECC.Koblitz.Curve) != 'undefined')) { |
67 | Clipperz.Crypto.ECC.StandardCurves._K283 = new Clipperz.Crypto.ECC.Koblitz.Curve({ | 64 | Clipperz.Crypto.ECC.StandardCurves._K283 = new Clipperz.Crypto.ECC.Koblitz.Curve({ |
68 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), | 65 | modulus: new Clipperz.Crypto.ECC.Koblitz.Value('08000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 000010a1', 16), |
69 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), | 66 | a: new Clipperz.Crypto.ECC.Koblitz.Value('0', 16), |
70 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), | 67 | b: new Clipperz.Crypto.ECC.Koblitz.Value('1', 16), |
71 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ | 68 | G: new Clipperz.Crypto.ECC.Koblitz.Point({ |
72 | x: new Clipperz.Crypto.ECC.Koblitz.Value('0503213f 78ca4488 3f1a3b81 62f188e5 53cd265f 23c1567a 16876913 b0c2ac24 58492836', 16), | 69 | x: new Clipperz.Crypto.ECC.Koblitz.Value('0503213f 78ca4488 3f1a3b81 62f188e5 53cd265f 23c1567a 16876913 b0c2ac24 58492836', 16), |
diff --git a/frontend/gamma/js/Clipperz/Crypto/PRNG.js b/frontend/gamma/js/Clipperz/Crypto/PRNG.js index 266b909..adfdb16 100644 --- a/frontend/gamma/js/Clipperz/Crypto/PRNG.js +++ b/frontend/gamma/js/Clipperz/Crypto/PRNG.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { | 30 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { |
34 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; | 31 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; |
35 | } | 32 | } |
36 | 33 | ||
37 | try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { | 34 | try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { |
38 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; | 35 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; |
39 | } | 36 | } |
40 | 37 | ||
41 | if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } | 38 | if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } |
42 | 39 | ||
43 | //############################################################################# | 40 | //############################################################################# |
44 | 41 | ||
45 | Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { | 42 | Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { |
46 | args = args || {}; | 43 | args = args || {}; |
47 | //MochiKit.Base.bindMethods(this); | 44 | //MochiKit.Base.bindMethods(this); |
48 | 45 | ||
49 | this._stack = new Clipperz.ByteArray(); | 46 | this._stack = new Clipperz.ByteArray(); |
50 | this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; | 47 | this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; |
51 | return this; | 48 | return this; |
52 | } | 49 | } |
53 | 50 | ||
54 | Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { | 51 | Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { |
55 | 52 | ||
56 | 'toString': function() { | 53 | 'toString': function() { |
57 | return "Clipperz.Crypto.PRNG.EntropyAccumulator"; | 54 | return "Clipperz.Crypto.PRNG.EntropyAccumulator"; |
58 | }, | 55 | }, |
59 | 56 | ||
60 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
61 | 58 | ||
62 | 'stack': function() { | 59 | 'stack': function() { |
63 | return this._stack; | 60 | return this._stack; |
64 | }, | 61 | }, |
65 | 62 | ||
66 | 'setStack': function(aValue) { | 63 | 'setStack': function(aValue) { |
67 | this._stack = aValue; | 64 | this._stack = aValue; |
68 | }, | 65 | }, |
69 | 66 | ||
70 | 'resetStack': function() { | 67 | 'resetStack': function() { |
71 | this.stack().reset(); | 68 | this.stack().reset(); |
72 | }, | 69 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/RSA.js b/frontend/gamma/js/Clipperz/Crypto/RSA.js index 4dad8f7..6844dba 100644 --- a/frontend/gamma/js/Clipperz/Crypto/RSA.js +++ b/frontend/gamma/js/Clipperz/Crypto/RSA.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; | 27 | throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } | 30 | if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } |
34 | 31 | ||
35 | Clipperz.Crypto.RSA.VERSION = "0.1"; | 32 | Clipperz.Crypto.RSA.VERSION = "0.1"; |
36 | Clipperz.Crypto.RSA.NAME = "Clipperz.RSA"; | 33 | Clipperz.Crypto.RSA.NAME = "Clipperz.RSA"; |
37 | 34 | ||
38 | //############################################################################# | 35 | //############################################################################# |
39 | 36 | ||
40 | MochiKit.Base.update(Clipperz.Crypto.RSA, { | 37 | MochiKit.Base.update(Clipperz.Crypto.RSA, { |
41 | 38 | ||
42 | //------------------------------------------------------------------------- | 39 | //------------------------------------------------------------------------- |
43 | 40 | ||
44 | 'publicKeyWithValues': function (e, d, n) { | 41 | 'publicKeyWithValues': function (e, d, n) { |
45 | varresult; | 42 | varresult; |
46 | 43 | ||
47 | result = {}; | 44 | result = {}; |
48 | 45 | ||
49 | if (e.isBigInt) { | 46 | if (e.isBigInt) { |
50 | result.e = e; | 47 | result.e = e; |
51 | } else { | 48 | } else { |
52 | result.e = new Clipperz.Crypto.BigInt(e, 16); | 49 | result.e = new Clipperz.Crypto.BigInt(e, 16); |
53 | } | 50 | } |
54 | 51 | ||
55 | if (d.isBigInt) { | 52 | if (d.isBigInt) { |
56 | result.d = d; | 53 | result.d = d; |
57 | } else { | 54 | } else { |
58 | result.d = new Clipperz.Crypto.BigInt(d, 16); | 55 | result.d = new Clipperz.Crypto.BigInt(d, 16); |
59 | } | 56 | } |
60 | 57 | ||
61 | if (n.isBigInt) { | 58 | if (n.isBigInt) { |
62 | result.n = n; | 59 | result.n = n; |
63 | } else { | 60 | } else { |
64 | result.n = new Clipperz.Crypto.BigInt(n, 16); | 61 | result.n = new Clipperz.Crypto.BigInt(n, 16); |
65 | } | 62 | } |
66 | 63 | ||
67 | return result; | 64 | return result; |
68 | }, | 65 | }, |
69 | 66 | ||
70 | 'privateKeyWithValues': function(e, d, n) { | 67 | 'privateKeyWithValues': function(e, d, n) { |
71 | return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n); | 68 | return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n); |
72 | }, | 69 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/SHA.js b/frontend/gamma/js/Clipperz/Crypto/SHA.js index 3cf8559..b07fa85 100644 --- a/frontend/gamma/js/Clipperz/Crypto/SHA.js +++ b/frontend/gamma/js/Clipperz/Crypto/SHA.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } | 30 | if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } |
34 | if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; } | 31 | if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; } |
35 | 32 | ||
36 | Clipperz.Crypto.SHA.VERSION = "0.3"; | 33 | Clipperz.Crypto.SHA.VERSION = "0.3"; |
37 | Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA"; | 34 | Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA"; |
38 | 35 | ||
39 | MochiKit.Base.update(Clipperz.Crypto.SHA, { | 36 | MochiKit.Base.update(Clipperz.Crypto.SHA, { |
40 | 37 | ||
41 | '__repr__': function () { | 38 | '__repr__': function () { |
42 | return "[" + this.NAME + " " + this.VERSION + "]"; | 39 | return "[" + this.NAME + " " + this.VERSION + "]"; |
43 | }, | 40 | }, |
44 | 41 | ||
45 | 'toString': function () { | 42 | 'toString': function () { |
46 | return this.__repr__(); | 43 | return this.__repr__(); |
47 | }, | 44 | }, |
48 | 45 | ||
49 | //----------------------------------------------------------------------------- | 46 | //----------------------------------------------------------------------------- |
50 | 47 | ||
51 | 'rotateRight': function(aValue, aNumberOfBits) { | 48 | 'rotateRight': function(aValue, aNumberOfBits) { |
52 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight"); | 49 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight"); |
53 | var result; | 50 | var result; |
54 | 51 | ||
55 | result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits)); | 52 | result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits)); |
56 | 53 | ||
57 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight"); | 54 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight"); |
58 | return result; | 55 | return result; |
59 | }, | 56 | }, |
60 | 57 | ||
61 | 'shiftRight': function(aValue, aNumberOfBits) { | 58 | 'shiftRight': function(aValue, aNumberOfBits) { |
62 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight"); | 59 | //Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight"); |
63 | var result; | 60 | var result; |
64 | 61 | ||
65 | result = aValue >>> aNumberOfBits; | 62 | result = aValue >>> aNumberOfBits; |
66 | 63 | ||
67 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight"); | 64 | //Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight"); |
68 | return result; | 65 | return result; |
69 | }, | 66 | }, |
70 | 67 | ||
71 | //----------------------------------------------------------------------------- | 68 | //----------------------------------------------------------------------------- |
72 | 69 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/SRP.js b/frontend/gamma/js/Clipperz/Crypto/SRP.js index 0eef6ec..3b25275 100644 --- a/frontend/gamma/js/Clipperz/Crypto/SRP.js +++ b/frontend/gamma/js/Clipperz/Crypto/SRP.js | |||
@@ -1,72 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { | 30 | try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { |
34 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!"; | 31 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!"; |
35 | } | 32 | } |
36 | 33 | ||
37 | try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { | 34 | try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { |
38 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!"; | 35 | throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!"; |
39 | } | 36 | } |
40 | 37 | ||
41 | if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; } | 38 | if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; } |
42 | 39 | ||
43 | Clipperz.Crypto.SRP.VERSION = "0.1"; | 40 | Clipperz.Crypto.SRP.VERSION = "0.1"; |
44 | Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP"; | 41 | Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP"; |
45 | 42 | ||
46 | //############################################################################# | 43 | //############################################################################# |
47 | 44 | ||
48 | MochiKit.Base.update(Clipperz.Crypto.SRP, { | 45 | MochiKit.Base.update(Clipperz.Crypto.SRP, { |
49 | 46 | ||
50 | '_n': null, | 47 | '_n': null, |
51 | '_g': null, | 48 | '_g': null, |
52 | //------------------------------------------------------------------------- | 49 | //------------------------------------------------------------------------- |
53 | 50 | ||
54 | 'n': function() { | 51 | 'n': function() { |
55 | if (Clipperz.Crypto.SRP._n == null) { | 52 | if (Clipperz.Crypto.SRP._n == null) { |
56 | Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16); | 53 | Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16); |
57 | } | 54 | } |
58 | 55 | ||
59 | return Clipperz.Crypto.SRP._n; | 56 | return Clipperz.Crypto.SRP._n; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //------------------------------------------------------------------------- | 59 | //------------------------------------------------------------------------- |
63 | 60 | ||
64 | 'g': function() { | 61 | 'g': function() { |
65 | if (Clipperz.Crypto.SRP._g == null) { | 62 | if (Clipperz.Crypto.SRP._g == null) { |
66 | Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation) | 63 | Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation) |
67 | } | 64 | } |
68 | 65 | ||
69 | return Clipperz.Crypto.SRP._g; | 66 | return Clipperz.Crypto.SRP._g; |
70 | }, | 67 | }, |
71 | 68 | ||
72 | //----------------------------------------------------------------------------- | 69 | //----------------------------------------------------------------------------- |