Jump to content
  • Advertisement
  • entries
    109
  • comments
    175
  • views
    117903

Encapsulation For Openssl Rsa/Blowfish In C++

Sign in to follow this  
Emmanuel Deloget

1367 views

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 !
Sign in to follow this  


4 Comments


Recommended Comments

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

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!