1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

fast decrypt

This commit is contained in:
Kyle Spearrin
2018-05-07 09:00:49 -04:00
parent c6c5dd6d46
commit de4494e1b3
9 changed files with 234 additions and 87 deletions

View File

@@ -0,0 +1,8 @@
export class DecryptParameters<T> {
encKey: T;
data: T;
iv: T;
macKey: T;
mac: T;
macData: T;
}

View File

@@ -9,6 +9,8 @@ export class SymmetricCryptoKey {
encType: EncryptionType;
keyB64: string;
encKeyB64: string;
macKeyB64: string;
constructor(key: ArrayBuffer, encType?: EncryptionType) {
if (key == null) {
@@ -26,7 +28,6 @@ export class SymmetricCryptoKey {
}
this.key = key;
this.keyB64 = Utils.fromBufferToB64(key);
this.encType = encType;
if (encType === EncryptionType.AesCbc256_B64 && key.byteLength === 32) {
@@ -41,5 +42,15 @@ export class SymmetricCryptoKey {
} else {
throw new Error('Unsupported encType/key length.');
}
if (this.key != null) {
this.keyB64 = Utils.fromBufferToB64(this.key);
}
if (this.encKey != null) {
this.encKeyB64 = Utils.fromBufferToB64(this.encKey);
}
if (this.macKey != null) {
this.macKeyB64 = Utils.fromBufferToB64(this.macKey);
}
}
}