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 { 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;
}); });