Guru's help !!!
I am working on a project that uses .net to encrypt form data and save it into a xml file (base64 encoded).
I have 3 methods of encryption and decryption working fine in .net
the problem is I'm needing to decrypt it server side using php by using the same KEY and IV that I used to encrypt the data with.
does anyone know how to use the same byte array's in php?
all the sources and examples I've seen are $key="secret pass"
which is fine but .net changes the "secret pass" into a byte array before passing the key. so when I use "secret pass" php side it is not the same.
example of what I'm doing (sort of):
vb.net code to encrypt:
Private key() As Byte = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}
Private iv() As Byte = {65, 110, 68, 26, 69, 178, 200, 219}
Dim tdesProvider As TripleDESCryptoServiceProvider = New TripleDESCryptoServiceProvider()
Dim cryptoTransform As ICryptoTransform = tdesProvider.CreateEncryptor(Me.key, Me.iv)
blah...blah...
Return Convert.ToBase64String(result)
PHP server side code to decrypt:
$key = array();/?
$IV = array();/?
$data = base64_decode("uvoEuC0Ap6ehdrp9Pn6yvQ==");
$iv_size = mcrypt_get_iv_size(MCRYPT_TripleDES, MCRYPT_MODE_EC😎;
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_decrypt(MCRYPT_TripleDES, $key, $data, MCRYPT_MODE_ECB, $iv);
echo $crypttext."\n";
~any help would be greatly appreciated!😕