Fix borked spacing in webcrypto.js
This commit is contained in:
parent
73f867f7de
commit
3a39602385
1 changed files with 11 additions and 10 deletions
|
@ -35,22 +35,22 @@ window.textsecure.subtle = (function() {
|
||||||
assertIsArrayBuffer(plaintext);
|
assertIsArrayBuffer(plaintext);
|
||||||
assertIsArrayBuffer(key);
|
assertIsArrayBuffer(key);
|
||||||
assertIsArrayBuffer(counter);
|
assertIsArrayBuffer(counter);
|
||||||
return CryptoJS.AES.encrypt(CryptoJS.enc.Latin1.parse(getString(plaintext)),
|
return CryptoJS.AES.encrypt(CryptoJS.enc.Latin1.parse(getString(plaintext)),
|
||||||
CryptoJS.enc.Latin1.parse(getString(key)),
|
CryptoJS.enc.Latin1.parse(getString(key)),
|
||||||
{mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)),
|
{mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)),
|
||||||
padding: CryptoJS.pad.NoPadding})
|
padding: CryptoJS.pad.NoPadding})
|
||||||
.ciphertext.toString(CryptoJS.enc.Latin1);
|
.ciphertext.toString(CryptoJS.enc.Latin1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function decryptAESCTR(ciphertext, key, counter) {
|
function decryptAESCTR(ciphertext, key, counter) {
|
||||||
assertIsArrayBuffer(ciphertext);
|
assertIsArrayBuffer(ciphertext);
|
||||||
assertIsArrayBuffer(key);
|
assertIsArrayBuffer(key);
|
||||||
assertIsArrayBuffer(counter);
|
assertIsArrayBuffer(counter);
|
||||||
return CryptoJS.AES.decrypt(btoa(getString(ciphertext)),
|
return CryptoJS.AES.decrypt(btoa(getString(ciphertext)),
|
||||||
CryptoJS.enc.Latin1.parse(getString(key)),
|
CryptoJS.enc.Latin1.parse(getString(key)),
|
||||||
{mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)),
|
{mode: CryptoJS.mode.CTR, iv: CryptoJS.enc.Latin1.parse(getString(counter)),
|
||||||
padding: CryptoJS.pad.NoPadding})
|
padding: CryptoJS.pad.NoPadding})
|
||||||
.toString(CryptoJS.enc.Latin1);
|
.toString(CryptoJS.enc.Latin1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function encryptAESCBC(plaintext, key, iv) {
|
function encryptAESCBC(plaintext, key, iv) {
|
||||||
|
@ -62,6 +62,7 @@ window.textsecure.subtle = (function() {
|
||||||
{iv: CryptoJS.enc.Latin1.parse(getString(iv))})
|
{iv: CryptoJS.enc.Latin1.parse(getString(iv))})
|
||||||
.ciphertext.toString(CryptoJS.enc.Latin1);
|
.ciphertext.toString(CryptoJS.enc.Latin1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function decryptAESCBC(ciphertext, key, iv) {
|
function decryptAESCBC(ciphertext, key, iv) {
|
||||||
assertIsArrayBuffer(ciphertext);
|
assertIsArrayBuffer(ciphertext);
|
||||||
assertIsArrayBuffer(key);
|
assertIsArrayBuffer(key);
|
||||||
|
|
Loading…
Reference in a new issue