Using ColdFusion, we're trying to process a customer payment by submitted details to Sage Pay.
We're getting errors 500 and 5080 no matter what we submit.
Our submitted crypt differs from the received version in a strange way: The first 1450 characters are indentical. Then a small section at the end is removed and a new, longer chuck is substituted.
We've looked at the Base64 options that have been suggested previously as a result of 12 bytes being received instead of 16, but that doesn't seem to solve the problem.
Has anyone seen this before and could anyone suggest things we could try to complete a purchase?
PLEASE! Gaz
Update from Kraig Johnson
Link to the specification PDF: https://www.opayo.ie/file/21086/download-document/FORM_Integration_and_Protocol_Guidelines_130515.pdf?token=FF7jKOvWemRFvw6UhEGOH1ULUpJBiXYIZKHSkhkl2II
Sage specifically states in the guide,
" The requirement is to encrypt the string as AES(block size 128-bit) in CBC mode with PKCS#5 padding using the provided password as both the key and initialisation vector and encode the result in hex."
If we don't encode it in base64 first, we get an invalid bit length error - 12 bytes.
stuff
is our string to encode and EncryptionPassword
is our key.
keyIVBytes = charsetDecode(EncryptionPassword, "utf-8");
base64Key = binaryEncode(keyIVBytes, "base64");
crypt=encrypt(stuff, base64Key,"AES/CBC/PKCS5Padding", "hex", keyIVBytes);