dont append header if AesCbc256_B64 for compat.

This commit is contained in:
Kyle Spearrin 2017-04-26 12:07:49 -04:00
parent 1ce4b5443b
commit 2cc2057f88
1 changed files with 12 additions and 4 deletions

View File

@ -6,13 +6,23 @@ var CipherString = function () {
this.initializationVector = null; this.initializationVector = null;
this.mac = null; this.mac = null;
if (arguments.length >= 2) { var constants = chrome.extension.getBackgroundPage().constantsService;
this.encryptedString = arguments[0] + '.' + arguments[1];
if (arguments.length >= 2) {
// ct and optional header
if (arguments[0] === constants.encType.AesCbc256_B64) {
this.encryptedString = arguments[1];
}
else {
this.encryptedString = arguments[0] + '.' + arguments[1];
}
// iv
if (arguments.length > 2 && arguments[2]) { if (arguments.length > 2 && arguments[2]) {
this.encryptedString += ('|' + arguments[2]); this.encryptedString += ('|' + arguments[2]);
} }
// mac
if (arguments.length > 3 && arguments[3]) { if (arguments.length > 3 && arguments[3]) {
this.encryptedString += ('|' + arguments[3]); this.encryptedString += ('|' + arguments[3]);
} }
@ -33,8 +43,6 @@ var CipherString = function () {
return; return;
} }
var constants = chrome.extension.getBackgroundPage().constantsService;
var headerPieces = this.encryptedString.split('.'), var headerPieces = this.encryptedString.split('.'),
encPieces; encPieces;