Use promise api in sym_encrypted_* packets
This commit is contained in:
parent
ded8926b27
commit
149f5d5191
|
@ -108,6 +108,8 @@ SymEncryptedIntegrityProtected.prototype.encrypt = function (sessionKeyAlgorithm
|
|||
this.encrypted = crypto.cfb.encrypt(prefixrandom, sessionKeyAlgorithm, tohash, key, false)
|
||||
.subarray(0, prefix.length + tohash.length);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -153,4 +155,6 @@ SymEncryptedIntegrityProtected.prototype.decrypt = function (sessionKeyAlgorithm
|
|||
} else {
|
||||
this.packets.read(decrypted.subarray(0, decrypted.length - 22));
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
|
|
@ -73,11 +73,14 @@ SymmetricallyEncrypted.prototype.decrypt = function (sessionKeyAlgorithm, key) {
|
|||
throw new Error('Decryption failed due to missing MDC in combination with modern cipher.');
|
||||
}
|
||||
this.packets.read(decrypted);
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
SymmetricallyEncrypted.prototype.encrypt = function (algo, key) {
|
||||
var data = this.packets.write();
|
||||
|
||||
this.encrypted = crypto.cfb.encrypt(
|
||||
crypto.getPrefixRandom(algo), algo, data, key, true);
|
||||
this.encrypted = crypto.cfb.encrypt(crypto.getPrefixRandom(algo), algo, data, key, true);
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user