C# ... mono ... openssl ... AES ...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

C# ... mono ... openssl ... AES ...

Edward Ned Harvey (openssl)

I'm figuring this out as I go along, but there's a lot of unknown before me, so I'm looking for any general wisdom, experience, or advice you guys might offer.  Ultimately, the reason I'm doing what I'm doing is academic.  Maybe I'll be doing actually useful work, but that's not the point.  The point is learning, because one day I will need to do useful work, probably developing stuff using openssl.

 

I'm learning C# on visual studio.  I expect I'll probably do some mono or objective-c in linux / osx too, but not yet.  There are two problems I'm attacking right now:  (a) Simply take some files or data stream, and encrypt/decrypt them.  (b) Use AES as the basis for a hash function (because it doesn't seem to already exist, and it should outperform md5 and sha functions, especially if you have AES-NI hardware.)

 

I wrote a class that wraps around AesCryptoServiceProvider to create an AES-based hash function.  It works, but performance is terrible.  The expectation is a hash function whose performance is on-par with md5 and sha1, but with the AES-NI instruction set, it should greatly outperform md5 and sha1.  Also, sadly, AesCryptoServiceProvider only supports 128-bit mode, which is sad.

 

I am looking at openssl.  Am I barking up the wrong tree?  I think some of openssl and/or libeay will provide cross-platform AES libraries that can be used in C, C++, C#, mono...  objective c...  256bit cipher blocksize...  Should be able to leverage AES-NI if available, and achieve decent performance, right?

 

I see projects such as http://openssl-net.sourceforge.net/ and I'm about to start digging deeper into that, but is it the right direction to be going?

 

Thanks...