Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Key Length #2

Open
arjusmoon860 opened this issue Jun 19, 2021 · 3 comments
Open

Invalid Key Length #2

arjusmoon860 opened this issue Jun 19, 2021 · 3 comments

Comments

@arjusmoon860
Copy link

Getting invalid Key Length error when trying to create checksum

Error: Invalid key length
at Cipheriv.createCipherBase (internal/crypto/cipher.js:103:19)
at Cipheriv.createCipherWithIV (internal/crypto/cipher.js:121:20)
at new Cipheriv (internal/crypto/cipher.js:227:22)
at Object.createCipheriv (crypto.js:123:10)
at Function.encrypt (/Users/arjusmoon/NodeApps/playground/paytm/node_modules/paytmchecksum/PaytmChecksum.js:9:23)
at Function.calculateChecksum (/Users/arjusmoon/NodeApps/playground/paytm/node_modules/paytmchecksum/PaytmChecksum.js:94:24)
at Function.generateSignatureByString (/Users/arjusmoon/NodeApps/playground/paytm/node_modules/paytmchecksum/PaytmChecksum.js:56:24)

var PaytmChecksum = require("paytmchecksum");

var paytmParams = {};

paytmParams["MID"] = "XXXXXXXXXX";
paytmParams["ORDERID"] = "232442453";

var paytmChecksum = PaytmChecksum.generateSignature(paytmParams, "XXXXXXXXXX");
paytmChecksum.then(function (checksum) {
console.log("generateSignature Returns: " + checksum);
}).catch(function (error) {
console.log(error);
});

@bvsk279
Copy link

bvsk279 commented Nov 11, 2022

Hi there

In your case, you most probably are using the Merchent_ID as a key. Use Merchent_KEY, It will work!

What you are currently using PaytmChecksum.generateSignature(paytmParams, Your_Merchent_ID);
What you should be using PaytmChecksum.generateSignature(paytmParams, Your_Merchent_KEY);

@amittiwari04
Copy link

@bvsk279 please tell me that , i am getting system error
response is ->> {head: {requestId: null, responseTimestamp: 1676197601140, version: v1}, body: {extraParamsMap: null, resultInfo: {resultStatus: F, resultCode: 501, resultMsg: System Error}}}
in test mode my code is working but in production it is not working

@Sahil6458
Copy link

Any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants