views:

183

answers:

4

I need a 3DES encrypt/decrypt library for my project. Do you know an implementation working on linux ?

Linux is the target platform, but I essantially compile/debug on Windows. Therefore it could be really appreciated if it could work on Windows, while not mandatory.

+2  A: 

Look for Eric Young's "libdes". This library can be also used on Windows as well as on Linux.

AlexKR
If you are going to use libdes, you might as well use OpenSSL, which is based on SSLeay (which is more or less what libdes evolved into). Which would allow one to take advantage of the bugfixes and optimizations since EAY stopped working on the code in the late 90s, and the easy availability of packages for most platforms.
Jack Lloyd
+6  A: 

OpenSSL is a very reputable, well tested open source security library. It's available for *nix and Windows. You can find it here

Edit, can't find a simple example right now. The API documentation is pretty good though.

There's a pre-compiled version for windows available for download from the openssl site. Most package managers will have a pre-packaged version of OpenSSL for Linux boxes, so you shouldn't have to compile your own version.

Glen
I don't know how works openSSL. But the name Secured Socket Layer makes me believe every tcp segments will eventually be encrypted using with this protocol. Actually some part of my payload data must not be encrypted (for instance a specific header provided before the encrypted data). Is openSSL still applicable in this case?
yves Baumes
yes you can use the lower level libs in libcrypto
pixelbeat
@yves, yes. You can use OpenSSL to encrypt a simple string. You supply the string and tell it which encryption algorithm to use to encrypt it. I'll edit my answer and supply a simple example in a few minutes
Glen
+1  A: 

you can compile libcrypto (openssl) for windows but I wouldn't recommend it: http://www.pixelbeat.org/programming/lib%5Fcrypto.html

Maybe NSS used by firefox would be useful? http://www.mozilla.org/projects/security/pki/nss/

Though I'd probably try something simple like: http://www.lysator.liu.se/~nisse/nettle/nettle.html

pixelbeat
+2  A: 

I have used botan before and I really like it. It has an implementation of not only 3DES but a lot of others algorithm. It is C++ so their API is Object Oriented (I like this feature while other might disagree). It supports a lot of systems (Windows, Linux, FreeBSD, etc), a lot of processors (x86, x86-64, IA-64, PowerPC and so on) and compilers. It seems to have a very good performance. Finally its license allows commercial developments.

At least it's Worth to have a look ;-)

fco.javier.sanz