From 64d8ae1f4948fbfb16cf71c0ea137d8856e4f041 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 30 Jan 2023 20:22:52 +0100 Subject: [PATCH] refs #5174 Hotfix --- modules/client/back/methods/tpv-transaction/confirm.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/client/back/methods/tpv-transaction/confirm.js b/modules/client/back/methods/tpv-transaction/confirm.js index 1ca2265a6..6c8ecebaf 100644 --- a/modules/client/back/methods/tpv-transaction/confirm.js +++ b/modules/client/back/methods/tpv-transaction/confirm.js @@ -66,17 +66,17 @@ module.exports = Self => { const secretKey = Buffer.from(merchant.secretKey, 'base64'); const iv = Buffer.alloc(8, 0); - const cipher = crypto.createDecipheriv('des-ede3-cbc', secretKey, iv); + const cipher = crypto.createCipheriv('des-ede3-cbc', secretKey, iv); cipher.setAutoPadding(false); const orderKey = cipher.update(zeroPad(orderId, 8), 'utf8', 'base64') - + cipher.final(); + + cipher.final('base64'); const res = crypto.createHmac('sha256', Buffer.from(orderKey, 'base64')) .update(merchantParameters) .digest('base64'); const base64Res = base64url.encode(res, 'base64'); - // if (base64Res !== signature) + // if (res !== signature) // throw new UserError('Invalid signature'); console.debug('Payment signature:', {