For my entire working career, I have been a Microsoft boy. I use Windows (including desktop and server operating systems) and I am a .NET fanboy. It’s a fun environment to program with, flexible and the tools are great. Also I have never really given open source much thought. Not because I don’t agree with it, or anything negative, but I have just never really bothered with it. Until recently that is.
About 7 years ago, I tried Open Office, and I didn’t have a very good experience. More recently I have been having more problems with Microsoft Office. It is slow, clunky, and quite unreliable in that I experience more crashes with it than I would like. I decided to try Open Office again, well more specifically Libre Office as that’s what the cool kids seem to recommend. This suite has had quite a while to mature, and you know what, I love it. It is fast, compact, and reliable. It interoperates with Microsoft Office documents perfectly and is a joy to use, so I have made this a permanent switch.
This got me thinking. If something like Libre Office is a slick as it is, and Free (Free as in cost and freedom with the source being open), then what other goodies are out there. This has led me on to switching over to many open source tools instead of commercial tools. I now frequently use Gimp and XMind. I am also looking to switch away from Enterprise Architect to an open source UML tool. I haven’t picked my final tool yet, but Modelio is looking very good.
I have recently released a small open source library that I thought might be useful to people. The library is called Block Encrypter it is designed to make asymmetric encryption of data in .NET / C# easier. The code in this library has been developed over the past year and used in my open source tools SafePad and Text Shredder. The way in which this library goes about encryption has been peer reviewed by many people in the open source community so should give you a level of comfort that it is secure in how it goes about encrypting data. Block Encrypter encrypts data using standard cryptographic primitives like AES, HMAC, PBKDF, and cryptographically secure random number generation.
First lets look at some usage examples. The main object in the library to call is the Block Encrypter object and this contains methods that allow you to encrypt/decrypt strings or byte arrays of data.
Overview of the Library
The library itself is quite straight forward to use and there are not that many objects to get to grips with. The main entry point for the library is the BlockEncrypter object. This object will then call out to the GzipCompression object, Aes object, and the ByteHelpers object.
The library is also well covered in unit tests that exercise the majority of the functionality.
I have released the next version of Text Shredder which incorporates some tweaks and features from peer review of users of the application on the internet.
The release notes are as follows :
Added a HMAC to the encrypted message. The ciphertext + original salt is HMACed using the AES key. When the message is decrypted, the HMAC is recomputed and compared to the original. If it doesn’t match then the message has been corrupted or tampered with.
Removed BCrypt from the internal password hash. After peer review it was deemed unnecessary as a PBKFD (Rfc2898) is used with 70,000 iterations to generate the AES key.
When setting up the AesCryptoServiceProvider, make the cipher mode and padding schemes more apparent. This application uses AES set to CBC mode with PKCS7 padding.
Add a word wrap option to the file menu. This enables/disables word wrap on all the text boxes.
When the user first loads up Text Shredder, show an upgrade warning stating that their message recipients must be using the same version of the tool. They can click on a “Do not show this again” checkbox to disable the warning then they next run the program.