Zero out private key parameters in clearPrivateParams

This commit is contained in:
Daniel Huigens 2020-01-24 16:48:40 +01:00
parent 889e0c4930
commit 26d107b856

View File

@ -388,7 +388,11 @@ SecretKey.prototype.clearPrivateParams = function () {
}
const algo = enums.write(enums.publicKey, this.algorithm);
this.params = this.params.slice(0, crypto.getPubKeyParamTypes(algo).length);
const publicParamCount = crypto.getPubKeyParamTypes(algo).length;
this.params.slice(publicParamCount).forEach(param => {
param.data.fill(0);
});
this.params.length = publicParamCount;
this.isEncrypted = true;
};