author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/beta/js/Clipperz/PM/Crypto.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Crypto.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Crypto.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Crypto.js b/frontend/beta/js/Clipperz/PM/Crypto.js index 6e9608c..ad16ff0 100644 --- a/frontend/beta/js/Clipperz/PM/Crypto.js +++ b/frontend/beta/js/Clipperz/PM/Crypto.js | |||
@@ -1,118 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer 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 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } | 26 | if (typeof(Clipperz.PM.Crypto) == 'undefined') { Clipperz.PM.Crypto = {}; } |
29 | 27 | ||
30 | Clipperz.PM.Crypto.VERSION = "0.2"; | 28 | Clipperz.PM.Crypto.VERSION = "0.2"; |
31 | Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto"; | 29 | Clipperz.PM.Crypto.NAME = "Clipperz.PM.Crypto"; |
32 | 30 | ||
33 | MochiKit.Base.update(Clipperz.PM.Crypto, { | 31 | MochiKit.Base.update(Clipperz.PM.Crypto, { |
34 | 32 | ||
35 | '__repr__': function () { | 33 | '__repr__': function () { |
36 | return "[" + this.NAME + " " + this.VERSION + "]"; | 34 | return "[" + this.NAME + " " + this.VERSION + "]"; |
37 | }, | 35 | }, |
38 | 36 | ||
39 | //------------------------------------------------------------------------- | 37 | //------------------------------------------------------------------------- |
40 | 38 | ||
41 | 'toString': function () { | 39 | 'toString': function () { |
42 | return this.__repr__(); | 40 | return this.__repr__(); |
43 | }, | 41 | }, |
44 | 42 | ||
45 | //------------------------------------------------------------------------- | 43 | //------------------------------------------------------------------------- |
46 | 44 | ||
47 | 'communicationProtocol': { | 45 | 'communicationProtocol': { |
48 | 'currentVersion': '0.2', | 46 | 'currentVersion': '0.2', |
49 | 'versions': { | 47 | 'versions': { |
50 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, | 48 | '0.1': Clipperz.PM.Connection.SRP['1.0'],//Clipperz.Crypto.SRP.versions['1.0'].Connection, |
51 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection, | 49 | '0.2': Clipperz.PM.Connection.SRP['1.1']//Clipperz.Crypto.SRP.versions['1.1'].Connection, |
52 | }, | 50 | }, |
53 | 'fallbackVersions': { | 51 | 'fallbackVersions': { |
54 | 'current':'0.1', | 52 | 'current':'0.1', |
55 | '0.2': '0.1', | 53 | '0.2': '0.1', |
56 | '0.1': null | 54 | '0.1': null |
57 | } | 55 | } |
58 | }, | 56 | }, |
59 | 57 | ||
60 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
61 | 59 | ||
62 | 'encryptingFunctions': { | 60 | 'encryptingFunctions': { |
63 | 'currentVersion': '0.3', | 61 | 'currentVersion': '0.3', |
64 | 'versions': { | 62 | 'versions': { |
65 | 63 | ||
66 | //##################################################################### | 64 | //##################################################################### |
67 | 65 | ||
68 | '0.1': { | 66 | '0.1': { |
69 | 'encrypt': function(aKey, aValue) { | 67 | 'encrypt': function(aKey, aValue) { |
70 | return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue)); | 68 | return Clipperz.Crypto.Base.encryptUsingSecretKey(aKey, Clipperz.Base.serializeJSON(aValue)); |
71 | }, | 69 | }, |
72 | 70 | ||
73 | 'deferredEncrypt': function(aKey, aValue) { | 71 | 'deferredEncrypt': function(aKey, aValue) { |
74 | var deferredResult; | 72 | var deferredResult; |
75 | 73 | ||
76 | deferredResult = new MochiKit.Async.Deferred(); | 74 | deferredResult = new MochiKit.Async.Deferred(); |
77 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue); | 75 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].encrypt, aKey, aValue); |
78 | deferredResult.callback(); | 76 | deferredResult.callback(); |
79 | 77 | ||
80 | return deferredResult; | 78 | return deferredResult; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | 'decrypt': function(aKey, aValue) { | 81 | 'decrypt': function(aKey, aValue) { |
84 | var result; | 82 | var result; |
85 | 83 | ||
86 | if (aValue != null) { | 84 | if (aValue != null) { |
87 | result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue)); | 85 | result = Clipperz.Base.evalJSON(Clipperz.Crypto.Base.decryptUsingSecretKey(aKey, aValue)); |
88 | } else { | 86 | } else { |
89 | result = null; | 87 | result = null; |
90 | } | 88 | } |
91 | 89 | ||
92 | return result; | 90 | return result; |
93 | }, | 91 | }, |
94 | 92 | ||
95 | 'deferredDecrypt': function(aKey, aValue) { | 93 | 'deferredDecrypt': function(aKey, aValue) { |
96 | var deferredResult; | 94 | var deferredResult; |
97 | 95 | ||
98 | deferredResult = new MochiKit.Async.Deferred(); | 96 | deferredResult = new MochiKit.Async.Deferred(); |
99 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue); | 97 | deferredResult.addCallback(Clipperz.PM.Crypto.encryptingFunctions.versions['0.1'].decrypt, aKey, aValue); |
100 | deferredResult.callback(); | 98 | deferredResult.callback(); |
101 | 99 | ||
102 | return deferredResult; | 100 | return deferredResult; |
103 | }, | 101 | }, |
104 | 102 | ||
105 | 'hash': function(aValue) { | 103 | 'hash': function(aValue) { |
106 | var result; | 104 | var result; |
107 | var strngResult; | 105 | var strngResult; |
108 | 106 | ||
109 | stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!! | 107 | stringResult = Clipperz.Crypto.Base.computeHashValue(aValue.asString()); //!!!!!!! |
110 | result = new Clipperz.ByteArray("0x" + stringResult); | 108 | result = new Clipperz.ByteArray("0x" + stringResult); |
111 | 109 | ||
112 | return result; | 110 | return result; |
113 | } | 111 | } |
114 | }, | 112 | }, |
115 | 113 | ||
116 | //##################################################################### | 114 | //##################################################################### |
117 | 115 | ||
118 | '0.2': { | 116 | '0.2': { |