Don't use Node symmetric crypto when !config.use_native

This commit is contained in:
Daniel Huigens 2020-01-31 23:17:15 +01:00
parent fc0052e35a
commit 801b44f2e7

View File

@ -50,7 +50,7 @@ const nodeAlgos = {
export default { export default {
encrypt: function(algo, key, plaintext, iv) { encrypt: function(algo, key, plaintext, iv) {
if (nodeCrypto && nodeAlgos[algo]) { // Node crypto library. if (util.getNodeCrypto() && nodeAlgos[algo]) { // Node crypto library.
return nodeEncrypt(algo, key, plaintext, iv); return nodeEncrypt(algo, key, plaintext, iv);
} }
if (algo.substr(0, 3) === 'aes') { if (algo.substr(0, 3) === 'aes') {
@ -83,7 +83,7 @@ export default {
}, },
decrypt: async function(algo, key, ciphertext, iv) { decrypt: async function(algo, key, ciphertext, iv) {
if (nodeCrypto && nodeAlgos[algo]) { // Node crypto library. if (util.getNodeCrypto() && nodeAlgos[algo]) { // Node crypto library.
return nodeDecrypt(algo, key, ciphertext, iv); return nodeDecrypt(algo, key, ciphertext, iv);
} }
if (algo.substr(0, 3) === 'aes') { if (algo.substr(0, 3) === 'aes') {