We have a POS (Ingenico) that uses DES3-CBC encryption using a derived key.
It sends encrypted data, and 10 bytes size Key Serial Number (KSN). I tried to use CKM_DES3_CBC_ENCRYPT_DATA
to derive the key, and decrypted the data using DES3-CBC mech. However, I get some gibberish data something like this:
\ufffd\u001dl\ufffdP\ufffdl\ufffd\ufffd\ufffd+\ufffd\ufffd[\ufffd\ufffdl\u0017\ufffd\ufffd\ufffd\u001f?E\ufffd[*\ufffdmd\u0014\u0009ay\ufffd\ufffd3\ufffd\ufffd
I am not sure if I am using correct mechanism to derive the key, or even using the correct mechanism to decrypt the data.
Can someone please help me understand what could have been wrong? Some info says I need to pad the KSN.
Edit: I asked a similar question on Github/PKCS