Ben PHP VB.NET şifreli bir dize alıyorum, çok saçma bir durum var. Ben anahtarı şifresini mümkün duyuyorum. I sonucu şifrelemek ve encrtypted dize almak istiyorum ama bir uyumsuzluk olsun. Herkes bana lütfen yardımcı olabilir ....
Below is the PHP CODE.
<?php
//$syscode=$_REQUEST['syscode'];
//The actual string is "blueberry" which is encrypted in VB.NET and sent to PHP
$syscode = "8yN73RDmMFuXo9ux8QKC6w=="; //This is the encrypted string as received from VB.NET
echo "Original Encrypted String Received from VB.NET: <br>".$syscode;
echo "<br><br>";
Decrypt($syscode);
echo "<br><br>";
Encrypt("blueberry");
function Decrypt($strToDecrypt){
global $strD;
$key64 = "cPSQAC05GBXzMhRRz7tm8cqg+vHdHyN5";
$iv64 = "jIShBJVBfXo=";
$encryptedString64 = $strToDecrypt;
$keybytes = base64_decode($key64);
$ivbytes = base64_decode($iv64);
$encryptedStringbytes = base64_decode($encryptedString64);
// use mcrypt library for encryption
$decryptRaw = mcrypt_decrypt(MCRYPT_3DES, $keybytes, $encryptedStringbytes, MCRYPT_MODE_CBC, $ivbytes);
$decryptString=trim($decryptRaw,"\x00..\x1F");
print "Decrypted by PHP:<br>$decryptString<br/>"; //The decrypted string should be "blueberry"
}
function Encrypt($strToEncrypt){
$key64 = "cPSQAC05GBXzMhRRz7tm8cqg+vHdHyN5";
$iv64 = "jIShBJVBfXo=";
$keybytes = base64_decode($key64);
$ivbytes = base64_decode($iv64);
// use mcrypt library for encryption
$encryptRaw = mcrypt_encrypt(MCRYPT_3DES, $keybytes, $strToEncrypt, MCRYPT_MODE_CBC, $ivbytes);
$encryptString=trim($encryptRaw,"\x00..\x1F");
$encryptString=(base64_encode(trim($encryptRaw)));
print "Encrypted in PHP:<br>$encryptString<br/>"; //This where the PHP encrypted result is not matching the VB.NET encryption result.
}
?>