About a month ago, I released v1.0.0 of dukpt node module into NPM with 3DES encryption support. Today, I released dukpt v2.0.0 with support for AES encryption and some major code refactoring. With these latest updates, users can now use AES as the primary encryption algorithm with Dukpt.
After the initial release of the module, I wrote an article on how this module can be used in your applications. If you haven’t read it yet, feel free to go check it out.
Let’s see how Dukpt can be used with AES using this module.
Encrypting Data with AES Dukpt
You can now provide encryptionMode parameter the value AES, to encrypt using AES.
const options = {
inputEncoding: 'ascii',
outputEncoding: 'hex',
encryptionMode: 'AES'
};
const encryptedCardDataAes = dukpt.dukptEncrypt(plainTextCardData, options);
Decrypting AES Dukpt Encrypted Data
To decrypt Dukpt AES encrypted data, you can provide decryptionMode as AES.
const options = {
outputEncoding: 'ascii',
decryptionMode: 'AES',
trimOutput: true
};
const decryptedCardDataAes = dukpt.dukptDecrypt(encryptedCardData, options);
With new AES support, you can use this library to encrypt data using Dukpt AES. Also I have tested this library in decrypting existing encrypted data using AES and it works well as well.
It’s time to check it out in your node application ;)
If you like to contribute it, please visit the github repo, report any issues, suggest new features or implement them yourself. I would really love to see some feedback on this module.
Background image source: federatedpayments.com/wp-content/uploads/20..