Click here to Skip to main content
13,559,658 members
Click here to Skip to main content
Add your own
alternative version


46 bookmarked
Posted 9 Jun 2003

Encryption and Decryption with ATL

, 9 Jun 2003
Rate this:
Please Sign up or sign in to vote.
WTL and console applications based on ATL implementation of Cryptography

Sample Image - EncryptionDecryption.gif


After reading ATL Server - Web Application/Web Service by Leon Finker I made a simple application to illustrate an ATL implementation of Cryptography. One is a command line tool, second is a WTL dialog (see above).


Please read Cryptographic Reference part of ATL Server Library Reference in MSDN Library.

Using the code

There are three projects, EncryptionDecryption which contains classes to store parameters, to parse command line and to encrypt/decrypt files based on provided parameters. Console, the console application and Window, the WTL application with GUI.

Parameters are stored in the class Parameters with simple getters/setters and one important method, IsValid which checks Parameters consistency. Only valid Parameters can be processed by the next class Engine with method DoJob. Errors are managed by class Error which simply stores error codes and messages. Class Parser (required in console application only) parses the command line arguments. The WTL project, dialog based, has an additional class, FileEdit, the file-drop target. Users do not have to type filenames or choose files from the open-file dialog, he/she can drag the file from Explorer and drop it on the edit control.

For the console application these steps are required:
  • Create Error, Parameters and Parser instances
  • Parse command line (ParseCommandLine method)
  • Check parameters (IsValid method)
  • Create Engine instance and call its DoJob method.
For the window application these steps are required:
  • Make Parameters as member of window dialog class
  • Create Error instance and set parameters read from dialog controls
  • Check parameters (IsValid method)
  • Create Engine instance and call it DoJob method.

As I said earlier, class FileEdit supports drag-drop files. But for users who use browse button, window dialog class keeps track of chosen folders. Two CString fields: m_szInputFileDir and m_szOutputFileDir remember paths during browsing.

There is possible to parametrize other things, like:
  • Cryptographic Provider Type in Initialize method of CCryptProv class
  • container name in Initialize method of CCryptProv class
  • import/export cryptographic key
  • and more...


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Poland Poland
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionCan not Encode any file with software Pin
Morteza Ghasemi15-Dec-04 19:53
memberMorteza Ghasemi15-Dec-04 19:53 
GeneralGeneral CryptoAPI w/ATL question Pin
Doug Schmidt8-Mar-04 20:42
memberDoug Schmidt8-Mar-04 20:42 
Generalcan't find file atlapp.h Pin
sycamine18-Jun-03 15:59
membersycamine18-Jun-03 15:59 
GeneralRe: can't find file atlapp.h Pin
Aardvark24-Jun-04 7:27
sussAardvark24-Jun-04 7:27 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180527.1 | Last Updated 10 Jun 2003
Article Copyright 2003 by ryszarddrozd
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid