2012-11-13 30 views
1

直到最近我們公司開始轉向PHP時,我們公司主要使用vbscript。在嘗試將SagePay表單工具集成到我們的其中一個項目中時,我遇到了這個障礙。php mcrypt相當於在windows服務器上的sagepay

我們在Windows 2008服務器上,這是無法更改的。服務器不包含mcrypt庫,我們的服務器主機將不會安裝它,因爲它是一個共享平臺。

問題行來自SagePay表單工具包,您可以使用SagePay付款。希望你們中的一些人能熟悉這些。

有問題的線路是:

//** perform encryption with PHP's MCRYPT module 
$strCrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $strEncryptionPassword, $strIn, MCRYPT_MODE_CBC, $strIV); 

這是一個較大的encrytion的部分功能如下:

//** Wrapper function do encrypt an encode based on strEncryptionType setting ** 
function encryptAndEncode($strIn) { 

    global $strEncryptionType 
      ,$strEncryptionPassword; 

    if ($strEncryptionType=="XOR") 
    { 
     //** XOR encryption with Base64 encoding ** 
     return base64Encode(simpleXor($strIn,$strEncryptionPassword)); 
    } 
    else 
    { 
     //** AES encryption, CBC blocking with PKCS5 padding then HEX encoding - DEFAULT ** 

     //** use initialization vector (IV) set from $strEncryptionPassword 
     $strIV = $strEncryptionPassword; 

     //** add PKCS5 padding to the text to be encypted 
     $strIn = addPKCS5Padding($strIn); 

     //** perform encryption with PHP's MCRYPT module 
     $strCrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $strEncryptionPassword, $strIn, MCRYPT_MODE_CBC, $strIV); 

     //** perform hex encoding and return 
     return "@" . bin2hex($strCrypt); 
    } 
} 

有誰知道我怎麼可能能夠繞過這個問題,或者一個等同的圖書館,我可以在它的地方實施?任何指針,提示或點在正確的方向將不勝感激。

EDIT好吧,經過研究後,據我所知,我只需要一個128位的AES加密函數,而不使用mcrypt。

+0

'_我們公司主要使用vbscript,直到最近,當我們開始轉換到PHP_' - 不斷惡化,或煎鍋着火(更嚴重的更清楚)。 –

+0

比靜止不動和煎炸更好。 – Bohdi

+0

我認爲他們都燒壞了很不好... –

回答