How to decrypt my encrypted text ( credit card number )

I had a scenario where I had 3 modules:

  1. Webhook (custom hook)
  2. z-credit
  3. Webhook (response)

Using this hook, I’m sending order information along with credit card details from my WordPress site. To comply with PCI DSS, we are encrypting credit card information using PHP. However, I am not sure how to decrypt the encrypted data, including the card number, CVV, and expiration date, and then use that decrypted data in the z-credit module.

In short, after receiving the data, I want to decrypt specific values ( only related credit card info those are also coming as encrypted using openssl_random_pseudo_bytes ) from the data and then use those decrypted values in the z-credit module.

Welcome to the Make community!

Do you have a link to the developer documentation? Usually that’s where you need to look for instructions on the decryption process.

2 Likes

I’m the person who actually encrypting those data but as I mention i’m not aware how to decrypt when make.com receive those data. is there any module or way to decrypt my encrypted text?

here’s an example code i’m using PCI DSS standard credit card encryption example with php · GitHub

I know how to decryption process but I just dont know how to implement in the make.com scenario

Have you tried the built-in Encryptor app? It has a Decrypt module that does AES-256

2 Likes

Looking at the decryptions code in your Github gist there are a few suggestions I can make as to equivalent Make modules:

// Function to decrypt credit card information
function decryptCreditCard($encryptedCreditCard, $encryptionKey)
{
    // Decode the base64-encoded string
    $decodedData = base64_decode($encryptedCreditCard);

This will require 2 Make string functions to decode the base64 encrypted value first

toString( toBinary(<base64encodedstring>;base64 ))

    // Extract the initialization vector and encrypted credit card data
    $iv = substr($decodedData, 0, 16);
    $encryptedCreditCardData = substr($decodedData, 16);

to get the IV you will apply the substring

{{substring(toString(toBinary("<base64encodedstring>"; "base64")); 0; 15)}}

to get the encrypted credit card data use

{{substring(toString(toBinary("<base64encodedstring>"; "base64")); 16)}}

    // Decrypt the credit card number using AES-256-CBC algorithm
    $decryptedCreditCard = openssl_decrypt(
        $encryptedCreditCardData,
        'aes-256-cbc',
        $encryptionKey,
        0, // Options
        $iv
    );

    return $decryptedCreditCard;
}

And now that you have the decoded IV you can pass this to the Encrypt module to decrypt the key with your encryption key that you setup in the key configuration at the top of this module.

I put together a little scenario that encrypts/decrypts a sample credit card with a 128 bit key – you’re going to have to create the key once before you run it and select it in the first and last module. I generate a 16 byte IV by using the letters A through P in random order in the first module.
blueprint (23).json (14.1 KB)

3 Likes