开发者

replicating openssl encryption in .NET?

开发者 https://www.devze.com 2023-02-20 04:20 出处:网络
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 metho开发者_运维知识库d t

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 metho开发者_运维知识库d 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 )


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号