Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Crypto.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Crypto.js | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Crypto.js b/frontend/gamma/js/Clipperz/PM/Crypto.js index 31fe349..cd10e33 100644 --- a/frontend/gamma/js/Clipperz/PM/Crypto.js +++ b/frontend/gamma/js/Clipperz/PM/Crypto.js | |||
@@ -2,6 +2,5 @@ | |||
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 |
@@ -9,10 +8,10 @@ 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. |
@@ -20,4 +19,3 @@ refer to http://www.clipperz.com. | |||
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 | ||
@@ -176,3 +174,3 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
176 | } catch (exception) { | 174 | } catch (exception) { |
177 | MochiKit.Logging.logError("Error while decrypting data [1]"); | 175 | Clipperz.logError("Error while decrypting data [1]"); |
178 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 176 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
@@ -208,3 +206,3 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
208 | } catch (exception) { | 206 | } catch (exception) { |
209 | MochiKit.Logging.logError("Error while decrypting data [2]"); | 207 | Clipperz.logError("Error while decrypting data [2]"); |
210 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 208 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
@@ -293,3 +291,3 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
293 | } catch (exception) { | 291 | } catch (exception) { |
294 | MochiKit.Logging.logError("Error while decrypting data [3]"); | 292 | Clipperz.logError("Error while decrypting data [3]"); |
295 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 293 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
@@ -324,3 +322,3 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
324 | deferredResult.addErrback(function(anError) { | 322 | deferredResult.addErrback(function(anError) { |
325 | MochiKit.Logging.logError("Error while decrypting data [4]"); | 323 | Clipperz.logError("Error while decrypting data [4]"); |
326 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 324 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |
@@ -361,9 +359,9 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
361 | 359 | ||
362 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 360 | //Clipperz.logDebug(">>> [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
363 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); | 361 | key = Clipperz.Crypto.SHA.sha_d256(new Clipperz.ByteArray(aKey)); |
364 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); | 362 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 1"); |
365 | value = Clipperz.Base.serializeJSON(aValue); | 363 | value = Clipperz.Base.serializeJSON(aValue); |
366 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); | 364 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 2"); |
367 | / * | 365 | / * |
368 | //MochiKit.Logging.logDebug("--> encrypt.fullSize: " + value.length); | 366 | //Clipperz.logDebug("--> encrypt.fullSize: " + value.length); |
369 | value = value.replace(/":{"label":"/g, '":{l:"'); | 367 | value = value.replace(/":{"label":"/g, '":{l:"'); |
@@ -374,10 +372,10 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
374 | value = value.replace(/", "favicon":"/g,'",f:"'); | 372 | value = value.replace(/", "favicon":"/g,'",f:"'); |
375 | //MochiKit.Logging.logDebug("<-- encrypt.compressed: " + value.length); | 373 | //Clipperz.logDebug("<-- encrypt.compressed: " + value.length); |
376 | * / | 374 | * / |
377 | data = new Clipperz.ByteArray(value); | 375 | data = new Clipperz.ByteArray(value); |
378 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); | 376 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 3"); |
379 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); | 377 | encryptedData = Clipperz.Crypto.AES.encrypt(key, data, aNonce); |
380 | //MochiKit.Logging.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); | 378 | //Clipperz.logDebug("--- [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt - 4"); |
381 | result = encryptedData.toBase64String(); | 379 | result = encryptedData.toBase64String(); |
382 | //MochiKit.Logging.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); | 380 | //Clipperz.logDebug("<<< [" + (new Date()).valueOf() + "] Clipperz.PM.Crypto.versions[0.3].encrypt"); |
383 | 381 | ||
@@ -410,3 +408,3 @@ MochiKit.Base.update(Clipperz.PM.Crypto, { | |||
410 | } catch (exception) { | 408 | } catch (exception) { |
411 | MochiKit.Logging.logError("Error while decrypting data"); | 409 | Clipperz.logError("Error while decrypting data"); |
412 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; | 410 | throw Clipperz.Crypto.Base.exception.CorruptedMessage; |