Cfiler Sample: Cryptography Filer

Click to open or copy the files for the Cfiler sample.

The Cfiler sample is a file encryptor that uses the Microsoft Cryptography API (CAPI). Its interface is an adaptation of the FILER sample. CFiler demonstrates many CAPI capabilities, including encryption, digital signature, and password-based key generation.

Cfiler's interface contains two list boxes: the directory list box and the file list box. Users navigate through their directory tree by double-clicking on the directory list box, which is located on the left of Cfiler's client area. Double-clicking on an entry in the directory list box once expands the directory, with all its subdirectories displayed indented below the entry. Double-clicking on the entry a second time collapses the entry.

Users can perform cryptographic operations on files and directories by selecting them in the file list box and selecting operations from the menu. When a user double-clicks on an item in the file list box, Cfiler encrypts the file and displays its filename in gray text. (Note: The plaintext file is deleted.) A second double-click causes Cfiler to decrypt the file and display its filename in its original color. Users sign files by first selecting them in the file list box and then clicking Sign on the File menu. Signed files appear in red text. Users can verify the signature of a file by selecting the file in the file list box and clicking Verify on the File menu. An encrypted file that has been signed appears in light red text.

When users encrypt and then sign files, they know that adversaries have not encrypted the files. Users can select the algorithms for encryption and the digital signature from the Options menu.

Building SDK Samples

This sample uses the following keywords:

_heapchk; _wrename; aboutproc; beginpaint; bitblt; bringwindowtotop; buildsigtable; c2r64; cfilerdecryptfile; cfilerencryptfile; cfilerisdirectory; cfilerlstrcmp; changedrive; charupper; checkheap; checkmenuitem; checkradiobutton; checkrm; closehandle; collapsedir; compare; constructdirname; constructlbentry; copyrect; createcompatiblebitmap; createcompatibledc; createdialog; createdirectory; createfile; createfontindirect; createmutex; createsolidbrush; createthread; createwindow; cryptacquirecontext; cryptcreatehash; cryptdecrypt; cryptderivekey; cryptdestroyhash; cryptdestroykey; cryptdlgproc; cryptencrypt; cryptexportkey; cryptgenkey; cryptgethashparam; cryptgetuserkey; crypthashdata; cryptimportkey; cryptreleasecontext; cryptsignhash; cryptverifysignature; decryptdir; defwindowproc; deletecriticalsection; deletedc; deletefile; deletehashdirectory; deletemenu; deleteobject; destroymenu; destroywindow; dialogbox; dispatchmessage; drawentireitem; drawitem; drawtext; drvwndproc; encryptdir; encryptdlgproc; enddialog; endpaint; entercriticalsection; enterpass; enumdrives; errormsg; exit; exit1; exit2; exitthread; expdir; expdirexit; exttextout; fillfile; fillrect; findclose; findfirstfile; findnextfile; findwindow; free; fullexpand; genrandomname; genrandomname2; getbkcolor; getclientrect; getcurrentdirectory; getdc; getdecrypteddirname; getdecryptedfilename; getdevicecaps; getdirdepth; getdlgitem; getdlgitemtext; getdrivebitmap; getdrivetype; getencryptpublickey; getfileattributes; getfnkey; getlastactivepopup; getlasterror; getlbtext; getlogicaldrives; getlogicaldrivestrings; getmenuitemcount; getmessage; getparent; getpass; getsigdir; getsigfilename; getsignaturepublickey; getsize; getsubmenu; getsyscolor; getsystemdirectory; getsystemmetrics; gettextmetrics; getwindowlong; getwindowtext; handleselectionstate; hashdlgproc; hassignature; hidesignatures; initializeapp; initializecriticalsection; insertmenu; invalidaterect; isencrypted; islegaltoadd; leavecriticalsection; loadbitmap; loadicon; loadmenu; logoff; logon; lstrcat; lstrcmp; lstrcpy; lstrlen; mainwndproc; makehashdirectory; makeintresource; makelong; malloc; messagebeep; messagebox; movewindow; outputdebugstring; postmessage; postquitmessage; rand; rcrypt_failed; readfile; regcreatekeyex; registerclass; regopenkeyex; regqueryvalueex; regsetvalueex; releasedc; releasemutex; removedirectory; rename; replaceescapecharacters; rgb; runlistboxitem; selectobject; sendmessage; separatepathname; separatepathname2; setbkcolor; setbkmode; setdlgitemtext; seterrormode; setfileattributes; setfocus; settextcolor; setwindowlong; setwindowtext; shatoradix64; showsignatures; showwindow; signfile; simplifyfilename; srand; switch; systemparametersinfo; tableadd; tablefind; tablefree; tablegethidden; tableinsert; tablenew; tableremove; tablesend; tablesort; text; textout; time; tolower; toupper; translateaccelerator; translatemessage; unreferenced_parameter; updatedrivesmenu; updatefilelb; updatewindow; verifyfile; waitforsingleobject; winhelp; winmain; writefile; wsprintf