I have a PHP decryption algorithm at one end, and a .Net encryption algorithm at another. I am using mcrypt_decrypt
for decrypt purpose in PHP code, and looking for an equivalent of mcrypt_encrypt
in .Net. More specifically, the PHP code that I want to convert to .Net is the following:
$cipher_alg = MCRYPT_RIJNDAEL_128;
$iv = mcrypt_create_iv ( mcrypt_get_iv_size ( $cipher_alg, MCRYPT_MODE_ECB ), MCRYPT_RAND );
$encrypted_string = mcrypt_encrypt ( $cipher_alg, $sessionkey, $string, MCRYPT_MODE_CBC, $iv );
$hex_encrypted_string = bin2hex ( $encrypted_string );
Is there an equivalent of mcrypt_encrypt
in .Net?