Question

I want to use following encryption method in C#. but I don't know whether it is available or not and how to use it exactly. Because I am much more familiar in web :'(. Task is I have to decrypt the user password where it encrypted in desktop app.(written in C#) and send as a json object. Using my php script I have to decode the json object and also decrypt password. Plz help. If this is not achievable plz suggest me a solution to use.

I want to use this code in C#

$key = '12345bcde';
$password = 'myPass@1001';

$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $password, MCRYPT_MODE_CBC, md5(md5($key))));

I got encryption and decryption method from here

Was it helpful?

Solution

The .net framework contains System.Security.Cryptography.Rijndael which will do the task.

BTW: normally you don't decrypt passwords. You use a one way function (preferrably with some salt) to encrypt the passwords and compare the encrypted password.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top