summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/Crypto
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/Crypto') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/Crypto/AES.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/Base.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/BigInt.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/PRNG.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/RSA.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/SHA.js22
-rw-r--r--frontend/beta/js/Clipperz/Crypto/SRP.js22
13 files changed, 130 insertions, 156 deletions
diff --git a/frontend/beta/js/Clipperz/Crypto/AES.js b/frontend/beta/js/Clipperz/Crypto/AES.js
index 7ddda3e..a5c63fb 100644
--- a/frontend/beta/js/Clipperz/Crypto/AES.js
+++ b/frontend/beta/js/Clipperz/Crypto/AES.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.AES depends on Clipperz.ByteArray!";
28} 26}
29 27
30 //Dependency commented to avoid a circular reference 28 //Dependency commented to avoid a circular reference
31//try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { 29//try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) {
32 //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!"; 30 //throw "Clipperz.Crypto.AES depends on Clipperz.Crypto.PRNG!";
33//} 31//}
34 32
35if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; } 33if (typeof(Clipperz.Crypto.AES) == 'undefined') { Clipperz.Crypto.AES = {}; }
36 34
37//############################################################################# 35//#############################################################################
38 36
39Clipperz.Crypto.AES.DeferredExecutionContext = function(args) { 37Clipperz.Crypto.AES.DeferredExecutionContext = function(args) {
40 args = args || {}; 38 args = args || {};
41 39
42 this._key = args.key; 40 this._key = args.key;
43 this._message = args.message; 41 this._message = args.message;
44 this._result = args.message.clone(); 42 this._result = args.message.clone();
45 this._nonce = args.nonce; 43 this._nonce = args.nonce;
46 this._messageLength = this._message.length(); 44 this._messageLength = this._message.length();
47 45
48 this._messageArray = this._message.arrayValues(); 46 this._messageArray = this._message.arrayValues();
49 this._resultArray = this._result.arrayValues(); 47 this._resultArray = this._result.arrayValues();
50 this._nonceArray = this._nonce.arrayValues(); 48 this._nonceArray = this._nonce.arrayValues();
51 49
52 this._executionStep = 0; 50 this._executionStep = 0;
53 51
54 return this; 52 return this;
55} 53}
56 54
57Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, { 55Clipperz.Crypto.AES.DeferredExecutionContext.prototype = MochiKit.Base.update(null, {
58 56
59 'key': function() { 57 'key': function() {
60 return this._key; 58 return this._key;
61 }, 59 },
62 60
63 'message': function() { 61 'message': function() {
64 return this._message; 62 return this._message;
65 }, 63 },
66 64
67 'messageLength': function() { 65 'messageLength': function() {
68 return this._messageLength; 66 return this._messageLength;
69 }, 67 },
70 68
diff --git a/frontend/beta/js/Clipperz/Crypto/Base.js b/frontend/beta/js/Clipperz/Crypto/Base.js
index d3a8e36..9acfc49 100644
--- a/frontend/beta/js/Clipperz/Crypto/Base.js
+++ b/frontend/beta/js/Clipperz/Crypto/Base.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.Base) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.Base depends on Clipperz.Base!"; 25 throw "Clipperz.Crypto.Base depends on Clipperz.Base!";
28} 26}
29 27
30if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } 28if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
31if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; } 29if (typeof(Clipperz.Crypto.Base) == 'undefined') { Clipperz.Crypto.Base = {}; }
32 30
33Clipperz.Crypto.Base.VERSION = "0.1"; 31Clipperz.Crypto.Base.VERSION = "0.1";
34Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base"; 32Clipperz.Crypto.Base.NAME = "Clipperz.Crypto.Base";
35 33
36//############################################################################# 34//#############################################################################
37 //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js) 35 //Downloaded on March 30, 2006 from http://anmar.eu.org/projects/jssha2/files/jssha2-0.3.zip (jsSha2/sha256.js)
38//############################################################################# 36//#############################################################################
39 37
40/* A JavaScript implementation of the Secure Hash Algorithm, SHA-256 38/* A JavaScript implementation of the Secure Hash Algorithm, SHA-256
41 * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/ 39 * Version 0.3 Copyright Angel Marin 2003-2004 - http://anmar.eu.org/
42 * Distributed under the BSD License 40 * Distributed under the BSD License
43 * Some bits taken from Paul Johnston's SHA-1 implementation 41 * Some bits taken from Paul Johnston's SHA-1 implementation
44 */ 42 */
45var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ 43var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
46function safe_add (x, y) { 44function safe_add (x, y) {
47 var lsw = (x & 0xFFFF) + (y & 0xFFFF); 45 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
48 var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 46 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
49 return (msw << 16) | (lsw & 0xFFFF); 47 return (msw << 16) | (lsw & 0xFFFF);
50} 48}
51function S (X, n) {return ( X >>> n ) | (X << (32 - n));} 49function S (X, n) {return ( X >>> n ) | (X << (32 - n));}
52function R (X, n) {return ( X >>> n );} 50function R (X, n) {return ( X >>> n );}
53function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));} 51function Ch(x, y, z) {return ((x & y) ^ ((~x) & z));}
54function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));} 52function Maj(x, y, z) {return ((x & y) ^ (x & z) ^ (y & z));}
55function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));} 53function Sigma0256(x) {return (S(x, 2) ^ S(x, 13) ^ S(x, 22));}
56function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));} 54function Sigma1256(x) {return (S(x, 6) ^ S(x, 11) ^ S(x, 25));}
57function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));} 55function Gamma0256(x) {return (S(x, 7) ^ S(x, 18) ^ R(x, 3));}
58function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));} 56function Gamma1256(x) {return (S(x, 17) ^ S(x, 19) ^ R(x, 10));}
59function core_sha256 (m, l) { 57function core_sha256 (m, l) {
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); 58 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);
61 var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19); 59 var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);
62 var W = new Array(64); 60 var W = new Array(64);
63 var a, b, c, d, e, f, g, h, i, j; 61 var a, b, c, d, e, f, g, h, i, j;
64 var T1, T2; 62 var T1, T2;
65 /* append padding */ 63 /* append padding */
66 m[l >> 5] |= 0x80 << (24 - l % 32); 64 m[l >> 5] |= 0x80 << (24 - l % 32);
67 m[((l + 64 >> 9) << 4) + 15] = l; 65 m[((l + 64 >> 9) << 4) + 15] = l;
68 for ( var i = 0; i<m.length; i+=16 ) { 66 for ( var i = 0; i<m.length; i+=16 ) {
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]; 67 a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7];
70 for ( var j = 0; j<64; j++) { 68 for ( var j = 0; j<64; j++) {
diff --git a/frontend/beta/js/Clipperz/Crypto/BigInt.js b/frontend/beta/js/Clipperz/Crypto/BigInt.js
index 41483a3..197cd9a 100644
--- a/frontend/beta/js/Clipperz/Crypto/BigInt.js
+++ b/frontend/beta/js/Clipperz/Crypto/BigInt.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } 25if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
28 26
29//############################################################################# 27//#############################################################################
30 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js 28 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js
31//############################################################################# 29//#############################################################################
32 30
33 31
34//////////////////////////////////////////////////////////////////////////////////////// 32////////////////////////////////////////////////////////////////////////////////////////
35// Big Integer Library v. 5.0 33// Big Integer Library v. 5.0
36// Created 2000, last modified 2006 34// Created 2000, last modified 2006
37// Leemon Baird 35// Leemon Baird
38// www.leemon.com 36// www.leemon.com
39// 37//
40// This file is public domain. You can use it for any purpose without restriction. 38// This file is public domain. You can use it for any purpose without restriction.
41// I do not guarantee that it is correct, so use it at your own risk. If you use 39// I do not guarantee that it is correct, so use it at your own risk. If you use
42// it for something interesting, I'd appreciate hearing about it. If you find 40// it for something interesting, I'd appreciate hearing about it. If you find
43// any bugs or make any improvements, I'd appreciate hearing about those too. 41// any bugs or make any improvements, I'd appreciate hearing about those too.
44// It would also be nice if my name and address were left in the comments. 42// It would also be nice if my name and address were left in the comments.
45// But none of that is required. 43// But none of that is required.
46// 44//
47// This code defines a bigInt library for arbitrary-precision integers. 45// This code defines a bigInt library for arbitrary-precision integers.
48// A bigInt is an array of integers storing the value in chunks of bpe bits, 46// A bigInt is an array of integers storing the value in chunks of bpe bits,
49// little endian (buff[0] is the least significant word). 47// little endian (buff[0] is the least significant word).
50// Negative bigInts are stored two's complement. 48// Negative bigInts are stored two's complement.
51// Some functions assume their parameters have at least one leading zero element. 49// Some functions assume their parameters have at least one leading zero element.
52// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, 50// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow,
53// so the caller must make sure overflow won't happen. 51// so the caller must make sure overflow won't happen.
54// For each function where a parameter is modified, that same 52// For each function where a parameter is modified, that same
55// variable must not be used as another argument too. 53// variable must not be used as another argument too.
56// So, you cannot square x by doing multMod_(x,x,n). 54// So, you cannot square x by doing multMod_(x,x,n).
57// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). 55// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
58// 56//
59// These functions are designed to avoid frequent dynamic memory allocation in the inner loop. 57// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
60// For most functions, if it needs a BigInt as a local variable it will actually use 58// For most functions, if it needs a BigInt as a local variable it will actually use
61// a global, and will only allocate to it when it's not the right size. This ensures 59// a global, and will only allocate to it when it's not the right size. This ensures
62// that when a function is called repeatedly with same-sized parameters, it only allocates 60// that when a function is called repeatedly with same-sized parameters, it only allocates
63// memory on the first call. 61// memory on the first call.
64// 62//
65// Note that for cryptographic purposes, the calls to Math.random() must 63// Note that for cryptographic purposes, the calls to Math.random() must
66// be replaced with calls to a better pseudorandom number generator. 64// be replaced with calls to a better pseudorandom number generator.
67// 65//
68// In the following, "bigInt" means a bigInt with at least one leading zero element, 66// In the following, "bigInt" means a bigInt with at least one leading zero element,
69// and "integer" means a nonnegative integer less than radix. In some cases, integer 67// and "integer" means a nonnegative integer less than radix. In some cases, integer
70// can be negative. Negative bigInts are 2s complement. 68// can be negative. Negative bigInts are 2s complement.
diff --git a/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js b/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js
index f91c7e9..bc60330 100644
--- a/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js
+++ b/frontend/beta/js/Clipperz/Crypto/BigInt_scoped.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } 25if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
28 26
29if (typeof(Leemon) == 'undefined') { Leemon = {}; } 27if (typeof(Leemon) == 'undefined') { Leemon = {}; }
30if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; } 28if (typeof(Baird.Crypto) == 'undefined') { Baird.Crypto = {}; }
31if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; } 29if (typeof(Baird.Crypto.BigInt) == 'undefined') { Baird.Crypto.BigInt = {}; }
32 30
33 31
34//############################################################################# 32//#############################################################################
35 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js 33 //Downloaded on March 05, 2007 from http://www.leemon.com/crypto/BigInt.js
36//############################################################################# 34//#############################################################################
37 35
38//////////////////////////////////////////////////////////////////////////////////////// 36////////////////////////////////////////////////////////////////////////////////////////
39// Big Integer Library v. 5.0 37// Big Integer Library v. 5.0
40// Created 2000, last modified 2006 38// Created 2000, last modified 2006
41// Leemon Baird 39// Leemon Baird
42// www.leemon.com 40// www.leemon.com
43// 41//
44// This file is public domain. You can use it for any purpose without restriction. 42// This file is public domain. You can use it for any purpose without restriction.
45// I do not guarantee that it is correct, so use it at your own risk. If you use 43// I do not guarantee that it is correct, so use it at your own risk. If you use
46// it for something interesting, I'd appreciate hearing about it. If you find 44// it for something interesting, I'd appreciate hearing about it. If you find
47// any bugs or make any improvements, I'd appreciate hearing about those too. 45// any bugs or make any improvements, I'd appreciate hearing about those too.
48// It would also be nice if my name and address were left in the comments. 46// It would also be nice if my name and address were left in the comments.
49// But none of that is required. 47// But none of that is required.
50// 48//
51// This code defines a bigInt library for arbitrary-precision integers. 49// This code defines a bigInt library for arbitrary-precision integers.
52// A bigInt is an array of integers storing the value in chunks of bpe bits, 50// A bigInt is an array of integers storing the value in chunks of bpe bits,
53// little endian (buff[0] is the least significant word). 51// little endian (buff[0] is the least significant word).
54// Negative bigInts are stored two's complement. 52// Negative bigInts are stored two's complement.
55// Some functions assume their parameters have at least one leading zero element. 53// Some functions assume their parameters have at least one leading zero element.
56// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow, 54// Functions with an underscore at the end of the name have unpredictable behavior in case of overflow,
57// so the caller must make sure overflow won't happen. 55// so the caller must make sure overflow won't happen.
58// For each function where a parameter is modified, that same 56// For each function where a parameter is modified, that same
59// variable must not be used as another argument too. 57// variable must not be used as another argument too.
60// So, you cannot square x by doing multMod_(x,x,n). 58// So, you cannot square x by doing multMod_(x,x,n).
61// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n). 59// You must use squareMod_(x,n) instead, or do y=dup(x); multMod_(x,y,n).
62// 60//
63// These functions are designed to avoid frequent dynamic memory allocation in the inner loop. 61// These functions are designed to avoid frequent dynamic memory allocation in the inner loop.
64// For most functions, if it needs a BigInt as a local variable it will actually use 62// For most functions, if it needs a BigInt as a local variable it will actually use
65// a global, and will only allocate to it when it's not the right size. This ensures 63// a global, and will only allocate to it when it's not the right size. This ensures
66// that when a function is called repeatedly with same-sized parameters, it only allocates 64// that when a function is called repeatedly with same-sized parameters, it only allocates
67// memory on the first call. 65// memory on the first call.
68// 66//
69// Note that for cryptographic purposes, the calls to Math.random() must 67// Note that for cryptographic purposes, the calls to Math.random() must
70// be replaced with calls to a better pseudorandom number generator. 68// be replaced with calls to a better pseudorandom number generator.
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC.js b/frontend/beta/js/Clipperz/Crypto/ECC.js
index bdfd9be..74eb02f 100644
--- a/frontend/beta/js/Clipperz/Crypto/ECC.js
+++ b/frontend/beta/js/Clipperz/Crypto/ECC.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26/* 24/*
27try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 25try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
28 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; 26 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
29} 27}
30 28
31if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } 29if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
32 30
33 31
34//############################################################################# 32//#############################################################################
35 33
36Clipperz.Crypto.ECC.BinaryField = {}; 34Clipperz.Crypto.ECC.BinaryField = {};
37 35
38//############################################################################# 36//#############################################################################
39 37
40Clipperz.Crypto.ECC.BinaryField.AbstractValue = function(aValue, aBase) { 38Clipperz.Crypto.ECC.BinaryField.AbstractValue = function(aValue, aBase) {
41 return this; 39 return this;
42} 40}
43 41
44Clipperz.Crypto.ECC.BinaryField.AbstractValue.prototype = MochiKit.Base.update(null, { 42Clipperz.Crypto.ECC.BinaryField.AbstractValue.prototype = MochiKit.Base.update(null, {
45 43
46 'asString': function(aBase) { 44 'asString': function(aBase) {
47 throw Clipperz.Base.exception.AbstractMethod; 45 throw Clipperz.Base.exception.AbstractMethod;
48 }, 46 },
49 47
50 'isZero': function() { 48 'isZero': function() {
51 throw Clipperz.Base.exception.AbstractMethod; 49 throw Clipperz.Base.exception.AbstractMethod;
52 }, 50 },
53 51
54 'shiftLeft': function(aNumberOfBitsToShift) { 52 'shiftLeft': function(aNumberOfBitsToShift) {
55 throw Clipperz.Base.exception.AbstractMethod; 53 throw Clipperz.Base.exception.AbstractMethod;
56 }, 54 },
57 55
58 'bitSize': function() { 56 'bitSize': function() {
59 throw Clipperz.Base.exception.AbstractMethod; 57 throw Clipperz.Base.exception.AbstractMethod;
60 }, 58 },
61 59
62 'isBitSet': function(aBitPosition) { 60 'isBitSet': function(aBitPosition) {
63 throw Clipperz.Base.exception.AbstractMethod; 61 throw Clipperz.Base.exception.AbstractMethod;
64 }, 62 },
65 63
66 'xor': function(aValue) { 64 'xor': function(aValue) {
67 throw Clipperz.Base.exception.AbstractMethod; 65 throw Clipperz.Base.exception.AbstractMethod;
68 }, 66 },
69 67
70 'compare': function(aValue) { 68 'compare': function(aValue) {
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js
index 01127c3..c39a075 100644
--- a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Curve.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
28} 26}
29if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } 27if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
30if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } 28if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
31 29
32Clipperz.Crypto.ECC.BinaryField.Curve = function(args) { 30Clipperz.Crypto.ECC.BinaryField.Curve = function(args) {
33 args = args || {}; 31 args = args || {};
34 32
35 this._modulus = args.modulus; 33 this._modulus = args.modulus;
36 34
37 this._a = args.a; 35 this._a = args.a;
38 this._b = args.b; 36 this._b = args.b;
39 this._G = args.G; 37 this._G = args.G;
40 this._r = args.r; 38 this._r = args.r;
41 this._h = args.h; 39 this._h = args.h;
42 40
43 this._finiteField = null; 41 this._finiteField = null;
44 42
45 return this; 43 return this;
46} 44}
47 45
48Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { 46Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, {
49 47
50 'asString': function() { 48 'asString': function() {
51 return "Clipperz.Crypto.ECC.BinaryField.Curve"; 49 return "Clipperz.Crypto.ECC.BinaryField.Curve";
52 }, 50 },
53 51
54 //----------------------------------------------------------------------------- 52 //-----------------------------------------------------------------------------
55 53
56 'modulus': function() { 54 'modulus': function() {
57 return this._modulus; 55 return this._modulus;
58 }, 56 },
59 57
60 'a': function() { 58 'a': function() {
61 return this._a; 59 return this._a;
62 }, 60 },
63 61
64 'b': function() { 62 'b': function() {
65 return this._b; 63 return this._b;
66 }, 64 },
67 65
68 'G': function() { 66 'G': function() {
69 return this._G; 67 return this._G;
70 }, 68 },
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js
index 650b479..de1e6a8 100644
--- a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
28} 26}
29if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } 27if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
30if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } 28if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
31 29
32Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) { 30Clipperz.Crypto.ECC.BinaryField.FiniteField = function(args) {
33 args = args || {}; 31 args = args || {};
34 this._modulus = args.modulus; 32 this._modulus = args.modulus;
35 33
36 return this; 34 return this;
37} 35}
38 36
39Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, { 37Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(null, {
40 38
41 'asString': function() { 39 'asString': function() {
42 return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")"; 40 return "Clipperz.Crypto.ECC.BinaryField.FiniteField (" + this.modulus().asString() + ")";
43 }, 41 },
44 42
45 //----------------------------------------------------------------------------- 43 //-----------------------------------------------------------------------------
46 44
47 'modulus': function() { 45 'modulus': function() {
48 return this._modulus; 46 return this._modulus;
49 }, 47 },
50 48
51 //----------------------------------------------------------------------------- 49 //-----------------------------------------------------------------------------
52 50
53 '_module': function(aValue) { 51 '_module': function(aValue) {
54 varresult; 52 varresult;
55 var modulusComparison; 53 var modulusComparison;
56//console.log(">>> binaryField.finiteField.(standard)module"); 54//console.log(">>> binaryField.finiteField.(standard)module");
57 55
58 modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); 56 modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value);
59 57
60 if (modulusComparison < 0) { 58 if (modulusComparison < 0) {
61 result = aValue; 59 result = aValue;
62 } else if (modulusComparison == 0) { 60 } else if (modulusComparison == 0) {
63 result = [0]; 61 result = [0];
64 } else { 62 } else {
65 var modulusBitSize; 63 var modulusBitSize;
66 var resultBitSize; 64 var resultBitSize;
67 65
68 result = aValue; 66 result = aValue;
69 67
70 modulusBitSize = this.modulus().bitSize(); 68 modulusBitSize = this.modulus().bitSize();
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js
index 6661839..c5db6c6 100644
--- a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Point.js
@@ -1,64 +1,62 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
28} 26}
29if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } 27if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
30if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } 28if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
31 29
32Clipperz.Crypto.ECC.BinaryField.Point = function(args) { 30Clipperz.Crypto.ECC.BinaryField.Point = function(args) {
33 args = args || {}; 31 args = args || {};
34 this._x = args.x; 32 this._x = args.x;
35 this._y = args.y; 33 this._y = args.y;
36 34
37 return this; 35 return this;
38} 36}
39 37
40Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, { 38Clipperz.Crypto.ECC.BinaryField.Point.prototype = MochiKit.Base.update(null, {
41 39
42 'asString': function() { 40 'asString': function() {
43 return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")"; 41 return "Clipperz.Crypto.ECC.BinaryField.Point (" + this.x() + ", " + this.y() + ")";
44 }, 42 },
45 43
46 //----------------------------------------------------------------------------- 44 //-----------------------------------------------------------------------------
47 45
48 'x': function() { 46 'x': function() {
49 return this._x; 47 return this._x;
50 }, 48 },
51 49
52 'y': function() { 50 'y': function() {
53 return this._y; 51 return this._y;
54 }, 52 },
55 53
56 //----------------------------------------------------------------------------- 54 //-----------------------------------------------------------------------------
57 55
58 'isZero': function() { 56 'isZero': function() {
59 return (this.x().isZero() && this.y().isZero()) 57 return (this.x().isZero() && this.y().isZero())
60 }, 58 },
61 59
62 //----------------------------------------------------------------------------- 60 //-----------------------------------------------------------------------------
63 __syntaxFix__: "syntax fix" 61 __syntaxFix__: "syntax fix"
64}); 62});
diff --git a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js
index b5beafa..278c299 100644
--- a/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js
+++ b/frontend/beta/js/Clipperz/Crypto/ECC/BinaryField/Value.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!";
28} 26}
29if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; } 27if (typeof(Clipperz.Crypto.ECC) == 'undefined') { Clipperz.Crypto.ECC = {}; }
30if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; } 28if (typeof(Clipperz.Crypto.ECC.BinaryField) == 'undefined') { Clipperz.Crypto.ECC.BinaryField = {}; }
31 29
32Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase) { 30Clipperz.Crypto.ECC.BinaryField.Value = function(aValue, aBase) {
33 if (aValue.constructor == String) { 31 if (aValue.constructor == String) {
34 varvalue; 32 varvalue;
35 varstringLength; 33 varstringLength;
36 var numberOfWords; 34 var numberOfWords;
37 vari,c; 35 vari,c;
38 36
39 if (aBase != 16) { 37 if (aBase != 16) {
40 throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase; 38 throw Clipperz.Crypto.ECC.BinaryField.Value.exception.UnsupportedBase;
41 } 39 }
42 40
43 value = aValue.replace(/ /g, ''); 41 value = aValue.replace(/ /g, '');
44 stringLength = value.length; 42 stringLength = value.length;
45 numberOfWords = Math.ceil(stringLength / 8); 43 numberOfWords = Math.ceil(stringLength / 8);
46 this._value = new Array(numberOfWords); 44 this._value = new Array(numberOfWords);
47 45
48 c = numberOfWords; 46 c = numberOfWords;
49 for (i=0; i<c; i++) { 47 for (i=0; i<c; i++) {
50 varword; 48 varword;
51 49
52 if (i < (c-1)) { 50 if (i < (c-1)) {
53 word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16); 51 word = parseInt(value.substr(stringLength-((i+1)*8), 8), 16);
54 } else { 52 } else {
55 word = parseInt(value.substr(0, stringLength-(i*8)), 16); 53 word = parseInt(value.substr(0, stringLength-(i*8)), 16);
56 } 54 }
57 55
58 this._value[i] = word; 56 this._value[i] = word;
59 } 57 }
60 } else if (aValue.constructor == Array) { 58 } else if (aValue.constructor == Array) {
61 var itemsToCopy; 59 var itemsToCopy;
62 60
63 itemsToCopy = aValue.length; 61 itemsToCopy = aValue.length;
64 while (aValue[itemsToCopy - 1] == 0) { 62 while (aValue[itemsToCopy - 1] == 0) {
65 itemsToCopy --; 63 itemsToCopy --;
66 } 64 }
67 65
68 this._value = aValue.slice(0, itemsToCopy); 66 this._value = aValue.slice(0, itemsToCopy);
69 } else if (aValue.constructor == Number) { 67 } else if (aValue.constructor == Number) {
70 this._value = [aValue]; 68 this._value = [aValue];
diff --git a/frontend/beta/js/Clipperz/Crypto/PRNG.js b/frontend/beta/js/Clipperz/Crypto/PRNG.js
index 39d0045..b5c3f8a 100644
--- a/frontend/beta/js/Clipperz/Crypto/PRNG.js
+++ b/frontend/beta/js/Clipperz/Crypto/PRNG.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
28} 26}
29 27
30try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { 28try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) {
31 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; 29 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!";
32} 30}
33 31
34try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { 32try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) {
35 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; 33 throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!";
36} 34}
37 35
38if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } 36if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; }
39 37
40//############################################################################# 38//#############################################################################
41 39
42Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { 40Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) {
43 args = args || {}; 41 args = args || {};
44 //MochiKit.Base.bindMethods(this); 42 //MochiKit.Base.bindMethods(this);
45 43
46 this._stack = new Clipperz.ByteArray(); 44 this._stack = new Clipperz.ByteArray();
47 this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; 45 this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256;
48 return this; 46 return this;
49} 47}
50 48
51Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { 49Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, {
52 50
53 'toString': function() { 51 'toString': function() {
54 return "Clipperz.Crypto.PRNG.EntropyAccumulator"; 52 return "Clipperz.Crypto.PRNG.EntropyAccumulator";
55 }, 53 },
56 54
57 //------------------------------------------------------------------------- 55 //-------------------------------------------------------------------------
58 56
59 'stack': function() { 57 'stack': function() {
60 return this._stack; 58 return this._stack;
61 }, 59 },
62 60
63 'setStack': function(aValue) { 61 'setStack': function(aValue) {
64 this._stack = aValue; 62 this._stack = aValue;
65 }, 63 },
66 64
67 'resetStack': function() { 65 'resetStack': function() {
68 this.stack().reset(); 66 this.stack().reset();
69 }, 67 },
70 68
diff --git a/frontend/beta/js/Clipperz/Crypto/RSA.js b/frontend/beta/js/Clipperz/Crypto/RSA.js
index 6844dba..5a480f1 100644
--- a/frontend/beta/js/Clipperz/Crypto/RSA.js
+++ b/frontend/beta/js/Clipperz/Crypto/RSA.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!"; 25 throw "Clipperz.Crypto.RSA depends on Clipperz.Crypto.BigInt!";
28} 26}
29 27
30if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; } 28if (typeof(Clipperz.Crypto.RSA) == 'undefined') { Clipperz.Crypto.RSA = {}; }
31 29
32Clipperz.Crypto.RSA.VERSION = "0.1"; 30Clipperz.Crypto.RSA.VERSION = "0.1";
33Clipperz.Crypto.RSA.NAME = "Clipperz.RSA"; 31Clipperz.Crypto.RSA.NAME = "Clipperz.RSA";
34 32
35//############################################################################# 33//#############################################################################
36 34
37MochiKit.Base.update(Clipperz.Crypto.RSA, { 35MochiKit.Base.update(Clipperz.Crypto.RSA, {
38 36
39 //------------------------------------------------------------------------- 37 //-------------------------------------------------------------------------
40 38
41 'publicKeyWithValues': function (e, d, n) { 39 'publicKeyWithValues': function (e, d, n) {
42 varresult; 40 varresult;
43 41
44 result = {}; 42 result = {};
45 43
46 if (e.isBigInt) { 44 if (e.isBigInt) {
47 result.e = e; 45 result.e = e;
48 } else { 46 } else {
49 result.e = new Clipperz.Crypto.BigInt(e, 16); 47 result.e = new Clipperz.Crypto.BigInt(e, 16);
50 } 48 }
51 49
52 if (d.isBigInt) { 50 if (d.isBigInt) {
53 result.d = d; 51 result.d = d;
54 } else { 52 } else {
55 result.d = new Clipperz.Crypto.BigInt(d, 16); 53 result.d = new Clipperz.Crypto.BigInt(d, 16);
56 } 54 }
57 55
58 if (n.isBigInt) { 56 if (n.isBigInt) {
59 result.n = n; 57 result.n = n;
60 } else { 58 } else {
61 result.n = new Clipperz.Crypto.BigInt(n, 16); 59 result.n = new Clipperz.Crypto.BigInt(n, 16);
62 } 60 }
63 61
64 return result; 62 return result;
65 }, 63 },
66 64
67 'privateKeyWithValues': function(e, d, n) { 65 'privateKeyWithValues': function(e, d, n) {
68 return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n); 66 return Clipperz.Crypto.RSA.publicKeyWithValues(e, d, n);
69 }, 67 },
70 68
diff --git a/frontend/beta/js/Clipperz/Crypto/SHA.js b/frontend/beta/js/Clipperz/Crypto/SHA.js
index 635eb90..9605d1c 100644
--- a/frontend/beta/js/Clipperz/Crypto/SHA.js
+++ b/frontend/beta/js/Clipperz/Crypto/SHA.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
28} 26}
29 27
30if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; } 28if (typeof(Clipperz.Crypto) == 'undefined') { Clipperz.Crypto = {}; }
31if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; } 29if (typeof(Clipperz.Crypto.SHA) == 'undefined') { Clipperz.Crypto.SHA = {}; }
32 30
33Clipperz.Crypto.SHA.VERSION = "0.3"; 31Clipperz.Crypto.SHA.VERSION = "0.3";
34Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA"; 32Clipperz.Crypto.SHA.NAME = "Clipperz.Crypto.SHA";
35 33
36MochiKit.Base.update(Clipperz.Crypto.SHA, { 34MochiKit.Base.update(Clipperz.Crypto.SHA, {
37 35
38 '__repr__': function () { 36 '__repr__': function () {
39 return "[" + this.NAME + " " + this.VERSION + "]"; 37 return "[" + this.NAME + " " + this.VERSION + "]";
40 }, 38 },
41 39
42 'toString': function () { 40 'toString': function () {
43 return this.__repr__(); 41 return this.__repr__();
44 }, 42 },
45 43
46 //----------------------------------------------------------------------------- 44 //-----------------------------------------------------------------------------
47 45
48 'rotateRight': function(aValue, aNumberOfBits) { 46 'rotateRight': function(aValue, aNumberOfBits) {
49//Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight"); 47//Clipperz.Profile.start("Clipperz.Crypto.SHA.rotateRight");
50 var result; 48 var result;
51 49
52 result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits)); 50 result = (aValue >>> aNumberOfBits) | (aValue << (32 - aNumberOfBits));
53 51
54//Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight"); 52//Clipperz.Profile.stop("Clipperz.Crypto.SHA.rotateRight");
55 return result; 53 return result;
56 }, 54 },
57 55
58 'shiftRight': function(aValue, aNumberOfBits) { 56 'shiftRight': function(aValue, aNumberOfBits) {
59//Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight"); 57//Clipperz.Profile.start("Clipperz.Crypto.SHA.shiftRight");
60 var result; 58 var result;
61 59
62 result = aValue >>> aNumberOfBits; 60 result = aValue >>> aNumberOfBits;
63 61
64//Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight"); 62//Clipperz.Profile.stop("Clipperz.Crypto.SHA.shiftRight");
65 return result; 63 return result;
66 }, 64 },
67 65
68 //----------------------------------------------------------------------------- 66 //-----------------------------------------------------------------------------
69 67
70 'safeAdd': function() { 68 'safeAdd': function() {
diff --git a/frontend/beta/js/Clipperz/Crypto/SRP.js b/frontend/beta/js/Clipperz/Crypto/SRP.js
index 3b25275..8cc80ba 100644
--- a/frontend/beta/js/Clipperz/Crypto/SRP.js
+++ b/frontend/beta/js/Clipperz/Crypto/SRP.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { 24try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) {
27 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; 25 throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!";
28} 26}
29 27
30try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) { 28try { if (typeof(Clipperz.Crypto.BigInt) == 'undefined') { throw ""; }} catch (e) {
31 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!"; 29 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.BigInt!";
32} 30}
33 31
34try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) { 32try { if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { throw ""; }} catch (e) {
35 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!"; 33 throw "Clipperz.Crypto.SRP depends on Clipperz.Crypto.PRNG!";
36} 34}
37 35
38if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; } 36if (typeof(Clipperz.Crypto.SRP) == 'undefined') { Clipperz.Crypto.SRP = {}; }
39 37
40Clipperz.Crypto.SRP.VERSION = "0.1"; 38Clipperz.Crypto.SRP.VERSION = "0.1";
41Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP"; 39Clipperz.Crypto.SRP.NAME = "Clipperz.Crypto.SRP";
42 40
43//############################################################################# 41//#############################################################################
44 42
45MochiKit.Base.update(Clipperz.Crypto.SRP, { 43MochiKit.Base.update(Clipperz.Crypto.SRP, {
46 44
47 '_n': null, 45 '_n': null,
48 '_g': null, 46 '_g': null,
49 //------------------------------------------------------------------------- 47 //-------------------------------------------------------------------------
50 48
51 'n': function() { 49 'n': function() {
52 if (Clipperz.Crypto.SRP._n == null) { 50 if (Clipperz.Crypto.SRP._n == null) {
53 Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16); 51 Clipperz.Crypto.SRP._n = new Clipperz.Crypto.BigInt("115b8b692e0e045692cf280b436735c77a5a9e8a9e7ed56c965f87db5b2a2ece3", 16);
54 } 52 }
55 53
56 return Clipperz.Crypto.SRP._n; 54 return Clipperz.Crypto.SRP._n;
57 }, 55 },
58 56
59 //------------------------------------------------------------------------- 57 //-------------------------------------------------------------------------
60 58
61 'g': function() { 59 'g': function() {
62 if (Clipperz.Crypto.SRP._g == null) { 60 if (Clipperz.Crypto.SRP._g == null) {
63 Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation) 61 Clipperz.Crypto.SRP._g = new Clipperz.Crypto.BigInt(2); //eventually 5 (as suggested on the Diffi-Helmann documentation)
64 } 62 }
65 63
66 return Clipperz.Crypto.SRP._g; 64 return Clipperz.Crypto.SRP._g;
67 }, 65 },
68 66
69 //----------------------------------------------------------------------------- 67 //-----------------------------------------------------------------------------
70 68