You are here

function _commerce_sagepay_removePKCS5Padding in Drupal Commerce SagePay Integration 7

Remove PKCS5 Padding from a string.

Parameters

string $decrypted: The decrypted string.

Return value

string String without the padding.

1 call to _commerce_sagepay_removePKCS5Padding()
_commerce_sagepay_decode_and_decrypt in includes/commerce_sagepay_utils.inc
Decode a returned string from SagePay.

File

includes/commerce_sagepay_utils.inc, line 121
commerce_sagepay_utils.inc Common utilities shared by all Integration methods.

Code

function _commerce_sagepay_removePKCS5Padding($decrypted) {
  $pad_char = ord($decrypted[strlen($decrypted) - 1]);
  return substr($decrypted, 0, -$pad_char);
}