From 3a39602385f3f2fb46914f7ad947de19b389a7e2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 26 Oct 2014 03:23:34 -0700 Subject: [PATCH] Fix borked spacing in webcrypto.js --- js/webcrypto.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/js/webcrypto.js b/js/webcrypto.js index 868748c8..33c2791f 100644 --- a/js/webcrypto.js +++ b/js/webcrypto.js @@ -35,22 +35,22 @@ window.textsecure.subtle = (function() { assertIsArrayBuffer(plaintext); assertIsArrayBuffer(key); assertIsArrayBuffer(counter); - return CryptoJS.AES.encrypt(CryptoJS.enc.Latin1.parse(getString(plaintext)), - CryptoJS.enc.Latin1.parse(getString(key)), - {mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)), - padding: CryptoJS.pad.NoPadding}) - .ciphertext.toString(CryptoJS.enc.Latin1); + return CryptoJS.AES.encrypt(CryptoJS.enc.Latin1.parse(getString(plaintext)), + CryptoJS.enc.Latin1.parse(getString(key)), + {mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)), + padding: CryptoJS.pad.NoPadding}) + .ciphertext.toString(CryptoJS.enc.Latin1); }; function decryptAESCTR(ciphertext, key, counter) { assertIsArrayBuffer(ciphertext); assertIsArrayBuffer(key); assertIsArrayBuffer(counter); - return CryptoJS.AES.decrypt(btoa(getString(ciphertext)), - CryptoJS.enc.Latin1.parse(getString(key)), - {mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)), - padding: CryptoJS.pad.NoPadding}) - .toString(CryptoJS.enc.Latin1); + return CryptoJS.AES.decrypt(btoa(getString(ciphertext)), + CryptoJS.enc.Latin1.parse(getString(key)), + {mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)), + padding: CryptoJS.pad.NoPadding}) + .toString(CryptoJS.enc.Latin1); }; function encryptAESCBC(plaintext, key, iv) { @@ -62,6 +62,7 @@ window.textsecure.subtle = (function() { {iv: CryptoJS.enc.Latin1.parse(getString(iv))}) .ciphertext.toString(CryptoJS.enc.Latin1); }; + function decryptAESCBC(ciphertext, key, iv) { assertIsArrayBuffer(ciphertext); assertIsArrayBuffer(key);