crypto: use crypto.cleanse.
This commit is contained in:
parent
2d21c6bf0b
commit
1649b38504
@ -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;
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user