Have this Warning in terminal, having issue tracking down the source or the actual reason / cause of it.
(node:37770) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:37770) Warning: Use Cipheriv for counter mode of aes-256-ctr
Not much information to provide unfortunately. I understand it's something with Node, but no clue how to solve it. https://nodejs.org/api/crypto.html
Node -v stable 8.9.0 (bottled), HEAD
package.json
"dependencies": {
"axios": "^0.17.0",
"babel-plugin-wrap-in-js": "^1.1.1",
"babel-runtime": "^6.26.0",
"body-parser": "^1.18.2",
"compression": "^1.7.1",
"cookie": "^0.3.1",
"dotenv": "^4.0.0",
"express": "^4.16.2",
"express-session": "^1.15.6",
"firebase": "^4.6.0",
"firebase-admin": "^5.4.3",
"isomorphic-unfetch": "^2.0.0",
"js-cookie": "^2.2.0",
"lusca": "^1.5.2",
"next": "^4.1.4",
"next-redux-wrapper": "^1.3.4",
"node-sass": "^4.5.3",
"now-logs": "0.0.7",
"nprogress": "^0.2.0",
"orm": "^4.0.1",
"prop-types": "^15.6.0",
"raw-loader": "^1.0.0-beta.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.6",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^1.2.0",
"react-transition-group": "^2.2.1",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
"sass-loader": "^6.0.6",
"session-file-store": "^1.1.2",
"styled-jsx": "^2.1.2",
"timeme.js": "^2.0.3",
"uuid": "^3.1.0",
"webpack": "^3.8.1"
}
for above warning use
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'test@1234';
var iv = Buffer.from(Array.prototype.map.call(Buffer.alloc(16), () => {return Math.floor(Math.random() * 256)}));
var key = Buffer.concat([Buffer.from(password)], Buffer.alloc(32).length);
var cipher = crypto.createCipheriv(algorithm,password,iv)
in the createCipheriv method, we need to create one buffer for iv and one buffer for the key which contains password
instead of
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'test@1234';
var cipher = crypto.createCipher(algorithm,password)
while converting your data to cipher. it will remove the warning
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With