Click here to Skip to main content
15,887,676 members
Articles / Desktop Programming / ATL
Article

File Encryption Utility

Rate me:
Please Sign up or sign in to vote.
4.70/5 (21 votes)
22 Sep 2002GPL33 min read 280.7K   13.4K   90   81
File Encryption Utility based on Blowfish Encryption Algorithm.

Sample Image - FileEncryption.jpg

Introduction<o:p>

After a long search for a simple and secure file encryption utility, that is simple and intuitive to use I've decided to write something of my own.<o:p>

File Encryption utility is a simple tool for encrypting both text and binary files using the blowfish encryption algorithm.<o:p>

The utility can create a self extracting encrypted file. For a deep view of how to create a self extracted executable check my other article: Creating Self-Extracted Executable .<o:p>

Features<o:p>

File Encryption Utility Has the following features:<o:p>

  • Fast & Quick File Encryption/Decryption.<o:p>
  • Internal File Wiping Utility.<o:p>
  • Creating Self-Extracting Encrypted File.<o:p>
  • Explorer Integration (through Configuration Dialog).<o:p>
  • Command Line Parameters.<o:p>

Language<o:p>

The File Encryption utility is writen in native C++ using ATL only for windowing classing.<o:p>

The usage of ATL is minimal so anyone who is not familiar with the library should be able to understand the code as well.<o:p>

Overview<o:p>

File Encryption Utility is divided to few small projects:<o:p>

  • FileEnc – The UI of the file encryption utility, also containing the Processing class which is also used by SelfExtract and it is responsible for reading/writing files.<o:p>
  • Enc_Blowfish – Blowfish encryption implementation (based upon Bruce Schneier and Jim Conger implementation).<o:p>
  • SelfExtract – Self Extracting executable "header".<o:p>
  • GenLib – Small Library holding all commonly used items in other project parts.<o:p>
  • Builder – Small Console utility for creating the final File Encryption Executable.<o:p>

GenLib – The General Library<o:p>

In order to save time and to have a central point for all general purpose classes I'm working with a static library called GenLib.<o:p>

A stripped version of the GenLib is available with the File Encryption Utility. In this version you can see the following general purpose classes:<o:p>

  • GenFiles – Openning OpenFile/SaveFile and OpenDirectory Dialog Boxes.<o:p>
  • SelfExtract – Creating Self-Extracting Executable.<o:p>
  • Thread – Implementation of a parent class for classes who want to execute code in separate thread (more information can be seen in the header – thread.h).<o:p>
  • FileWipe – Wiping a File from Hard Drive.<o:p>

All those classes are under the GenLib namespace.<o:p>

Additional Encryptions<o:p>

Inside the FileEnc project there's an interface called EncryptionInterface – implementing this interface can allow you to easily change the encryption the utility uses.<o:p>

Implementing this interface requires only stream cipher implementation and saves all the overhead of working with files.<o:p>

Blowfish implementation is statically linked to the utility in order to avoid hacking by changing the dll. With a few minutes of work the utility can support a number of encryption dlls that can be loaded at runtime based on the users decision.<o:p>

Security<o:p>

In order to make the utility the most secure I can I've tried wiping information from memory when the application closes.<o:p>

When looking at the source, you can see that I've used ZeroMemory API and few others APIs to delete information from memory (like the password used).<o:p>

When encrypting a file you can mark the 'Wipe Source After Process' checkbox and by that insure that the file you're encrypting is not accessible.<o:p>

Remarks<o:p>

Decryption does NOT verify password correctness (information is being encrypted without adding any information about the file). As a result when decrypting with the wrong password you will receive a file with junk inside - this is not a bug.<o:p>

The file encryption is based upon the password length - larger passwords equal better security.<o:p>

Although I believe that the file wiping method is very secure, to be 100% sure you should use a product dedicated to that purpose.<o:p>

Reference<o:p>

Blowfish encryption algorithm - http://www.schneier.com/paper-blowfish-fse.html

Revision History

23 Sep 2002 - Initial Revision

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Product Manager
Israel Israel
Nir is a Product Manager from Israel with past Software Engineering Experience.

You're welcome to visit his photography site:
http://www.dremer.net/

Comments and Discussions

 
AnswerRe: How to hide/encrypt folder Pin
purpureleaf13-Apr-05 23:20
purpureleaf13-Apr-05 23:20 
GeneralNot work for zip files Pin
Wyz8-Sep-04 17:58
Wyz8-Sep-04 17:58 
GeneralRe: Not work for zip files Pin
Anonymous8-Sep-04 22:05
Anonymous8-Sep-04 22:05 
GeneralRe: Not work for zip files Pin
The_Mega_ZZTer21-Oct-05 15:13
The_Mega_ZZTer21-Oct-05 15:13 
GeneralRe: Not work for zip files Pin
damir_tk19-Nov-06 8:45
damir_tk19-Nov-06 8:45 
Generalmultiple file decryption Pin
Member 129424112-Aug-04 3:59
Member 129424112-Aug-04 3:59 
GeneralRe: multiple file decryption Pin
Nir Dremer18-Aug-04 21:33
Nir Dremer18-Aug-04 21:33 
QuestionHow to hide files Pin
KmAshif19-Jun-04 23:03
KmAshif19-Jun-04 23:03 
I want to hide a file from permanently from other user and want to restore it programmatically...There is many software which can do that..To set file attribute is hidden is not the solution..Is anybody can help me by giving a suitable idea or by giving the resource referrences...Thanks
AnswerRe: How to hide files Pin
Nir Dremer19-Jun-04 23:16
Nir Dremer19-Jun-04 23:16 
GeneralRe: How to hide files Pin
KmAshif19-Jun-04 23:50
KmAshif19-Jun-04 23:50 
GeneralRe: How to hide files Pin
Nir Dremer20-Jun-04 1:31
Nir Dremer20-Jun-04 1:31 
AnswerRe: How to hide files Pin
lszhangDream29-Sep-04 4:02
lszhangDream29-Sep-04 4:02 
AnswerRe: How to hide files Pin
The_Mega_ZZTer21-Oct-05 15:18
The_Mega_ZZTer21-Oct-05 15:18 
GeneralCompression and encryption Pin
Anthony_Yio23-May-04 19:36
Anthony_Yio23-May-04 19:36 
GeneralRe: Compression and encryption Pin
Nir Dremer23-May-04 21:51
Nir Dremer23-May-04 21:51 
QuestionLicensing &amp; Export? Pin
Anonymous27-Apr-04 20:28
Anonymous27-Apr-04 20:28 
AnswerRe: Licensing &amp; Export? Pin
Nir Dremer28-Apr-04 11:34
Nir Dremer28-Apr-04 11:34 
QuestionHow to make a DLL for this utility Pin
r_samavi23-Apr-04 15:27
r_samavi23-Apr-04 15:27 
AnswerRe: How to make a DLL for this utility Pin
Nir Dremer28-Apr-04 11:38
Nir Dremer28-Apr-04 11:38 
GeneralSelf-Decryptor Pin
Anonymous30-Mar-04 6:26
Anonymous30-Mar-04 6:26 
GeneralRe: Self-Decryptor Pin
Nir Dremer30-Mar-04 8:08
Nir Dremer30-Mar-04 8:08 
Generalblowfish encryption structure Pin
Rob Brasier26-Dec-03 14:43
Rob Brasier26-Dec-03 14:43 
GeneralRe: blowfish encryption structure Pin
Nir Dremer27-Dec-03 8:55
Nir Dremer27-Dec-03 8:55 
GeneralUse of ZeroMemory Pin
Steve Hopkins10-Sep-03 23:35
Steve Hopkins10-Sep-03 23:35 
GeneralBug Pin
xwcvb23-Aug-03 23:03
xwcvb23-Aug-03 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.