crypto: use crypto.cleanse.

This commit is contained in:
Christopher Jeffrey 2016-11-11 20:09:24 -08:00
parent 2d21c6bf0b
commit 1649b38504
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -274,11 +274,11 @@ crypto.encrypt = co(function* encrypt(data, passphrase, iv) {
try {
data = crypto.encipher(data, key, iv);
} catch (e) {
key.fill(0);
crypto.cleanse(key);
throw e;
}
key.fill(0);
crypto.cleanse(key);
return data;
});
@ -328,11 +328,11 @@ crypto.decrypt = co(function* decrypt(data, passphrase, iv) {
try {
data = crypto.decipher(data, key, iv);
} catch (e) {
key.fill(0);
crypto.cleanse(key);
throw e;
}
key.fill(0);
crypto.cleanse(key);
return data;
});