I want to use triple DES in C# for encryption/decryption of (utf8) strings with a (utf8) key of any length.
I am looking for these three functions
public static string Encrypt(string data, string key)
{
...
}
public static string Decrypt(string data, string key)
{
...
}
public static string GenerateKeyFromString(string str)
{
...
}
Note: Before anyone links to it, the http://www.geekzilla.co.uk/view7B360BD8-A77C-4F1F-BCA0-ACD0F6795F61.htm implementation does not work, I have thoroughly tested it.
I have done lots of searching and found bits of the problem like EncryptOneBlock
and others but I am looking for a complete 'for dummies' implementation which I think would be useful for others too.
Thanks in advance!
TripleDESCryptoServiceProvider
? – TherrienDecrypt()
function would always throw aSystem.Security.Cryptography.CryptographicException
. – ImpotenceTripleDESCryptoServiceProvider
if recommended to (if it saves time). – Impotence