1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

Added encrypt-then-mac support to cryptoService

This commit is contained in:
Kyle Spearrin
2016-12-10 10:33:58 -05:00
parent d0e2840cd8
commit 70ded7f57b
2 changed files with 113 additions and 27 deletions

View File

@@ -3,8 +3,11 @@ var CipherString = function (encryptedString) {
this.decryptedValue = null;
if (encryptedString) {
this.initializationVector = this.encryptedString.split('|')[0];
this.cipherText = this.encryptedString.split('|')[1];
var encPieces = this.encryptedString.split('|');
this.initializationVector = encPieces[0];
this.cipherText = encPieces[1];
this.mac = encPieces.length > 2 ? encPieces[2] : null;
}
};
@@ -42,7 +45,7 @@ var Folder = function (obj, alreadyEncrypted) {
!function () {
CipherString.prototype.decrypt = function (callback) {
var deferred = Q.defer();
var deferred = Q.defer();
if (!this.decryptedValue) {
var cryptoService = chrome.extension.getBackgroundPage().cryptoService;