2013-11-21 57 views
1

我得到錯誤mcrypt_encrypt():IV參數必須與第二行上塊大小一樣長。PHP錯誤:mcrypt_encrypt():IV參數必須與塊大小一樣長

$data = "Currency=GBP&SuccessURL=test&FailureURL=test&VendorEMail=test&SendEMail=1&eMailMessage=&Amount=&Description=&CustomerName=test test&CustomerEMail=test&BillingSurname=test&BillingFirstnames=test&BillingAddress1=test&BillingAddress2=test&BillingCity=test&BillingPostCode=test&BillingCountry=test&BillingPhone=test&DeliverySurname=test&DeliveryFirstnames=test&DeliveryAddress1=test&DeliveryAddress2=test&DeliveryCity=test&DeliveryPostCode=test&DeliveryCountry=test\u0003\u0003\u0003"; 
    $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, 'test', $data, MCRYPT_MODE_CBC, 'test'); 

回答

1

IV參數不是mcrypt_encrypt()作爲我認爲這將是第4參數。它實際上是最後一個參數,第5個參數。
這裏指定http://php.net/manual/en/function.mcrypt-encrypt.phpiv

此實例的$ data數據塊大小爲16,所以mcrypt_encrypt()中的最後一個參數需要爲16個字符長。

blocksize是數據字符串應該被整除的數字,否則它的最後部分需要被填充到它才能被整除。

2

在我的情況下,它也給了同樣的錯誤。我之前使用的是實際的密碼。但是,當我使用加密的密碼,它的工作。在sagepay.php第54行中,protected $ encryptPassword =「」。在這裏我使用了加密的密碼,這是我在測試帳戶中獲得的。現在它的工作。
這可能會有所幫助。
謝謝

+0

加密密碼意味着如何加密密碼可以詳細說明一下嗎? – comeback4you

+0

你不需要加密密碼。你會得到你的acc。 – Sajal

+0

thanx你是對的...我得到了密碼。你可以請分享你的電子郵件ID。 – comeback4you

相關問題