macBytes must exist if key has macKey

This commit is contained in:
Kyle Spearrin 2018-01-18 09:03:27 -05:00
parent 59f2fc0e73
commit 335c94e24c
1 changed files with 5 additions and 0 deletions

View File

@ -482,6 +482,11 @@ export class CryptoService implements CryptoServiceInterface {
const keyForEnc = await this.getKeyForEncryption(key);
const theKey = this.resolveLegacyKey(encType, keyForEnc);
if (theKey.macKey != null && macBytes == null) {
console.error('macBytes required.');
return null;
}
if (encType !== theKey.encType) {
// tslint:disable-next-line
console.error('encType unavailable.');