Encapsulation For Openssl Rsa/Blowfish In C++

posted in Computer food
Published January 10, 2011
Advertisement
Now, that's not a wonderful piece of code, filled with incredible meta-programming snippets. But it's a piece of code that's usable and - more importantly - that can be modified to suit your needs.

So let me introduce you a small part of a large library en devenir. This code encapsulates the blowfish symetric cipher and the RSA asymetric cipher from OpenSSL. As of today (version 0.2), only Linux is supported, but a port to Windows is planned as soon as I get my own PC back. As a bonus, a modern C++ implementation (little endian) of the SHA256 hashing algorithm is provided as well (used together with RSA private encryption, this allows you to sign messages ; which is kind of cool).

If you are interested by the code, just remember the following:
  • you're not going to see a lot of comments ; this shall not be needed (my code is not that horrible).
  • a large part of the code uses templated policies.
  • whenever I can, I play with the standard library. While waiting C++1x, this code uses a small portion of the TR1 (tr1::uint32_t and tr1::uint64_t).
  • You finally have the possibility to watch some code of mine in action! (ok, that's not really of interest).

Licensing information is not included yet. You can consider that this code is licensed under some kind of BSD-style licence (that is: do whatever with this code ; just remember I wrote it, but if you want to act like you are the original writer, you are allowed to do that).

Class list:
  • ekogen::security::rsa_cryptograph
  • ekogen::security::rsa_key
  • ekogen::security::rsa_public_key
  • ekogen::security::blowfish_cryptograph
  • ekogen::security::blowfish_key
  • ekogen::security::xor_cryptograph
  • ekogen::security::xor_key
  • ekogen::security::default_rng
  • ekogen::security::xor_rng
  • ekogen::security::symetric_cryptograph
  • ekogen::security::symetric_key
  • ekogen::security::asymetric_cryptograph
  • ekogen::security::asymetric_key
  • ekogen::security::public_asymetric_key
  • ekogen::encoder::base64
  • ekogen::encoder::hex
  • ekogen::encoder::basic_encoder

Function list
  • ekogen::security::sha256(const unsigned char*, std::size_t, std::vector&);
  • ekogen::security::sha256(const unsigned char*, std::size_t, E::output_type&, E)
  • ekogen::security::sha256(Iterator, Iterator, std::vector&);
  • ekogen::security::sha256(Iterator, Iterator, E::output_type&, E)

PDF Documents that explains part of the interface are in directory /doc. The build system is very rudimentary and shall be replaced by a more advanced one in a few days (probably cmake, since it works on all the platforme I target).

Details (in French, sorry) about the code can be found on my blog. For those who don't speak French, google makes a decent work at translating the text.

Happy... something !
Previous Entry Fr1st (GDC) pots!
1 likes 4 comments

Comments

Aardvajk
Where on Earth have you been?
January 10, 2011 08:31 PM
Emmanuel Deloget
Well, on Earth :)

I've been here and there, but most of my online activities were contributed to French speaking web sites.

But I'm back ! :D
January 11, 2011 01:57 PM
Aardvajk
Well, nice to see your journal live again. Welcome back :)
January 12, 2011 10:49 AM
Emmanuel Deloget
Thanks !

Happy to see known faces BTW :)
January 12, 2011 08:00 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement