AES(128-bit) encryption CBC mode + PKCS#5 padding

Problems with the Windows version of XAMPP, questions, comments, and anything related.

AES(128-bit) encryption CBC mode + PKCS#5 padding

Postby MikeSiencyn » 24. September 2021 16:23

Hi folks

I’ve been chasing around through various websites for the many weeks on this one,
seeming to get somewhere only to be told by Opayo that I’m not encrypting the crypt string properly.

Their instructions were:
The string must be encrypted using AES (block size 128-bit) in CBC mode with PKCS#5 padding.
Use the provided password as both the key and initialisation vector and encode the result in hex (making sure the letters are in upper case).
•Prepend the ‘@’ sign to the beginning of the encoded result.
•To decrypt, ensure you remove the ‘@’ sign before using the same procedure in decryption mode.

The code I was led to believe should work was (I’ve blanked out my password):
// DEFINE the cipher
define('AES_128_CBC', 'aes-128-cbc');
$encryption_key = 'xxxxxxxxxxxx';
$iv = 'xxxxxxxxxxxx';
// encrypt the data
$encrypt = openssl_encrypt($preCrypt, AES_128_CBC, $encryption_key, 0, $iv);
$Crypt = "@".strtoupper(bin2hex($encrypt));

Please can someone help me with this as it’s the last thing I need to do to get my wife’s vintage clothing and accessories website working.
The site has been ready for months but SumUp and Opayo have been leading me a merry dance!
The version of PHP I’m using is 7.4.12
Many thanks
All the best
Mike
MikeSiencyn
 
Posts: 24
Joined: 02. February 2021 15:41
XAMPP version: 3.2.4
Operating System: Windows10



Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 145 guests