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 {
|
try {
|
||||||
data = crypto.encipher(data, key, iv);
|
data = crypto.encipher(data, key, iv);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
key.fill(0);
|
crypto.cleanse(key);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
key.fill(0);
|
crypto.cleanse(key);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
@ -328,11 +328,11 @@ crypto.decrypt = co(function* decrypt(data, passphrase, iv) {
|
|||||||
try {
|
try {
|
||||||
data = crypto.decipher(data, key, iv);
|
data = crypto.decipher(data, key, iv);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
key.fill(0);
|
crypto.cleanse(key);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
key.fill(0);
|
crypto.cleanse(key);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user