與this question類似,我已將網站遷移到使用VPS協議3.00。 我已經使用測試加密密鑰對測試網站進行了測試,所有測試都很好。當我切換到使用帶有現場加密密鑰的實時站點時,出現可怕的3045 : The Currency field is missing
錯誤。升級到VPS協議後生效的加密密鑰不工作3.00
當使用VPS協議2.22時,相同的加密密鑰在實時站點上工作,但在切換到3.00時不會加密。
我還將發佈的數據提供給解密腳本,該腳本使用相同的密鑰來解密crypt
而沒有問題。
任何人都可以想到爲什麼代碼可以針對test.
而不是live.
使用適當的密鑰,或者爲什麼2.22接受密鑰而3.0不使用?是live.
與3.00做任何額外的檢查,test.
是不是?
我的代碼已經稍微從集成套件修改的功能:
function addPKCS5Padding($input) {
$blockSize = 16;
$padd = "";
// Pad input to an even block size boundary.
$length = $blockSize - (strlen($input) % $blockSize);
for ($i = 1; $i <= $length; $i++) {
$padd .= chr($length);
}
return $input . $padd;
}
// AES encryption, CBC blocking with PKCS5 padding then HEX encoding.
function sagepay_encrypt($string, $key) {
// Add PKCS5 padding to the text to be encrypted.
$string = addPKCS5Padding($string);
// Perform encryption with PHP's MCRYPT module.
$crypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $string, MCRYPT_MODE_CBC, $key);
// Perform hex encoding and return.
return "@" . strtoupper(bin2hex($crypt));
}
它是由填充$crypt_values
陣列和調用稱爲:
$crypt_source = sagepay_buildcrypt($crypt_values);
$crypt = sagepay_encrypt($crypt_source, $sagepay_key);
的$crypt_source
是有效的和(在很大程度上)該在所有情況下都相同:
VendorTxCode=20150721020857Deannatest&VendorData=Deanna test&Amount=1&Currency=GBP&Description=Quote Reference Deanna test&BillingSurname=Earley&BillingFirstnames=Deanna&BillingAddress1.....
如果需要,我可以訪問測試網站並演示所有組合。 – Deanna
如果您可以提供供應商名稱,我可以爲您着想...... –