mutex
mutex

Reputation: 7728

replicating openssl encryption in .NET?

I'm wondering if anyone can suggest a good way to replicate the following openssl command line in .NET? I'm not looking for someone to write the code, just suggest the best method to use. I have RijndaelManaged working doing AES 256 CBC mode and can base64 encode it, etc. But, I'm unclear on how openssl is generating\using "salt" - is the salt a part of the result base64 encoded output?

$ echo 1234 | openssl enc -aes-256-cbc -a -salt -pass pass:<passphrase>

Any pointers to decent documentation on openssl commandline? (I don't see salt or aes-256-cbc on http://openssl.org/docs/apps/openssl.html )

EDIT:

OK, found the documentation for openssl enc at http://openssl.org/docs/apps/enc.html# - just trying to grok it. :)

EDIT2:

I think this is closer to what I am needing ( http://deusty.blogspot.com/2009/04/decrypting-openssl-aes-files-in-c.html )

Upvotes: 0

Views: 949

Answers (3)

You can also achieve this with OpenSSL Library for .NET

DidiSoft.OpenSsl.OpenSslCipher cipher = new DidiSoft.OpenSsl.OpenSslCipher();
bool isBase64 = true;
string encrypted = cipher.EncryptString(CipherAlgorithm.Aes_256_Cfb, "1234", 
                                        "<passphrase>", isBase64);

Disclaimer: I work for DidiSoft

Upvotes: 0

Julien Roncaglia
Julien Roncaglia

Reputation: 17837

OpenSSL is basically some dlls with and executable over them. There is an old project OpenSSL.Net on sourceforge to bind them in C# maybe you could start there.

Upvotes: 1

Jumbogram
Jumbogram

Reputation: 2259

The answers to openssl des3 decrypting in java should get you going.

Upvotes: 1

Related Questions