gbEncrypt
gbEncrypt is an extremely simple freeware application for entering and saving text.
Encryption of the saved text files is supported. Standard text files are supported, as well
as encrypted files saved by gbEncrypt.
gbEncrypt uses a single main screen, consisting of a toolbar and an edit control.
Using gbEncrypt
Using gbEncrypt couldn't be simpler.
- "Open" any existing text file, or use "New" to create a new file.
- Edit the content
- Press the "Encrypt" toolbar button to optionally encrypt content when saved
- Press "Save" on the toolbar to save the file
That's it. When gbEncrypt is opened, it automatically opens the file it was editing
in the last session. Note that if encryption is enabled, a password will be required
to save a file. Each file can have its own password, which must be entered before a
file can be opened.
gbEncrypt can detect whether a file is encrypted and when an encrypted file is selected
to be opened, the user will be asked to supply the password associated with that file.
Toolbar
Almost all of the commands and settings available in gbEncrypt are accessed through
the toolbar buttons. Normally, the toolbar consists of the following buttons.
However, the toolbar can be toggled between ful width and a "minimal" width using
the Ctl-M keyboard shortcut. Ctl-M hides those commands which are also available via
context menus, allowing for a smaller gbEncrypt window footprint.
New
Creates a new file.
Unless AutoSave is on, requests permission to save changes to the current file.
If changes are saved and encrypt is enabled, the user must supply a password.
Open
Opens an existing file.
Unless AutoSave is on, requests permission to save changes to the current file.
If changes are saved and encrypt is enabled, the user must supply a password.
The Open File dialog opens in the folder of the currently opened file.
Existing files may also be opened by dragging them to the gbEncrpt EXE
icon or shortcut icon.
Save
Saves the current file without prompting for user approval to save changes.
If changes are saved and encrypt is enabled, the user must supply a password.
If the currently opened file has been changed by the user, the Save icon on the
toolbar is grayed out.
The Save As file dialog opens in the folder of the currently opened file.
SaveAs
Saves the current file under a new name.
Cut/Copy/Paste/Delete
Standard windows commands for editing the content of the textbox.
Undo/Redo
In work ...
Find
Opens a Find & Replace dialog.
Encrypt
Toggles whether encryption will be applied when the file is saved. The dropdown menu
attached to the encrypt toolbar button also provides the following options which define
the criteria used to validate a password used to save a file.
- Minimum Characters Required
- Password must be at least as long as the minimum password length
- At Least 1 Number Required
- One of the password characters must be a number 0-9
- At Least 1 Capital Letter Required
- One of the password characters must be a capital letter
- No Spaces Allowed
- preceeding, embedded, and following spaces are not allowed
- Hide Password
- displays all asterisks in the password entry dialogs
- Set Minimum Characters
- opens dialog in which the user can enter the minimum password length
All of these options are off by default.
Font
Open a Font Selection dialog.
AutoSave
Toggles whether changes are automatically saved when the user exits from
gbEncrypt. Even if AutoSave is enabled, if Encrypt is enabled, the user
must enter a password for the file to be saved.
Actions
Provides a dropdown menu with the following options:
- Show Content Summary
- Displays a dialog with summary of the text editor content
- Sort Ascending
- Sorts the entire content of the text editor, in ascending order
- Sort Descending
- Sorts the entire content of the text editor, in descending order
- Upper Case
- Converts the entire content of the text editor to upper case
- Lower Case
- Converts the entire content of the text editor to lower case
- Add Line Numbers
- Insert line number into each line (permanent change unless Removed)
- Remove Line Numbers
- Remove line number from each line
- Select Font
- Displays a dialog for selecting the text editor font
- Select FG Color
- Sets the foreground color of the text editor
- Select BG Color
- Sets the background color of the text editor
- Show Matching Lines
- Copies any line containing the most recent search term to a temporary file, then opens that file in Notepad.
- Settings/AutoSave
- Save as Toolbar AutoSave
Help
When clicked, opens the online Help page in the user's default browser.
F1 may also be pressed to open the online Help page. The following dropdown menu is available:
File Format
gbEncrypt can Open standard, unencrypted text files. When unencrypted files are Saved,
they are saved with no modification to the content - just as with any other text editor.
But when a file is encrypted and saved to disk, gbEncrypt places a validation string at the
front of the file. The validation string is used by gbEncrypt to know when an encrypted file
is about to be opened. The process is somewhat transparent to the user, except for the need
to enter a password when entering/opening an encrypted file.
For those interested in the details, gbEncrypt places a null character at the start of
the file, followed by a validation string of characters which are encrypted using the password
supplied by the user. Text content of the files follows immediately after the validation string.
When gbEncrypt Opens a file, it checks that a null character is present as the first
character in the file. if the null character is found, gbEncrypt assumes that the file
is encrypted and then tests the characters immediately behind the null characters for the encrypted
validation string (requesting that the user enter a password as part of the process). If the user
entered password does not return the expected validation string, gbEncrypt will not open the
selected file and will instead create a new, unencrypted file.
Text Editor
The gbEncrypt application consists of just a toolbar and a text edit control. The text edit
control always fills the client area of the application.
A context menu (right mouse click) is available that provides the following menu options:
- Cut - copy selected text to the clipboard, then delete the text
- Copy - copy selected text to the clipboard
- Paste - paste clipboard text to the cursor
- Delete - delete the selected text
- Select All - selects all text in the editor
- Copy All - copies all text from the editor to the clipboard
- Insert Date/Time - inserts Date/Time at the cursor
- Reload File - Without further prompting, reloads the current file. This loses all changes made to the current document.
- Open File Location - open Windows Explorer to the folder containing the currently
opened file.
Short Cut Keys
These short cut keys / key combinations are supported:
- Ctl-X Cut
- Ctl-C Copy
- Ctl-V Paste
- Ctl-N New File
- Ctl-O Open Existing File
- Ctl-S Save File
- Ctl-L Edit Extension List
- Ctl-Z Undo/Redo
- del Delete
- Ctl-M Toggle Minimal Toolbar
Other Comments
Misecellaneous information is provided in this section.
Sessions
When gbEncrypt starts, it opens the file it was editing in the last session. The
gbEncrypt window size and position are also restored.
Password Entry
When entering a password needed to open or save a file, gbEncrypt does not limit the number
of times a password may be entered.
New File
New files are given a name such as "default_001.txt". gbEncrypt looks in the path of the
currently opened file and finds the first available number (i.e., 001, 002, ...) to assign
to the new file name.
New files are, by default, unencrypted. If New is executed, the Encrypt toolbar button will be released.
If New/Open are executed and the current file has been changed and Encrypt is on,
the user MUST enter a password or the New/Open operation is aborted.
Encryption Effect on Changes Flag
Changing the Encrypt toolbar button sets the "Changes" flag, indicating to gbEncrypt that the file
content has changed.
Encrypt Speed
In the PowerBASIC forums I created a thread that discussed various encryption routines, focussing
on speed of encryption. For gbEncrypt I used a medium speed encryption algorithm just to keep the
routine simple. See the forum thread if faster Save/Open speeds are critical to you.
Save
When Saving an encrypted file, which requires a password, failure to provide the password will abort
the Save operation. This includes a Save that is required (when changes have been made to the current file)
before Opening a new file, Opening an existing file, performing a SaveAs operation, or exiting the
application.
INI File
gbEncrypt application settings are saved in an INI file, kept in the same folder as the gbEncrypt application.
CFN
In the source code and possibly in the Help file, you'll see the letters CFN. This stands for
the "Current File Name" - the file being viewed in gbEncrypt.
Programmer Comments
The code for New/Open and to exit from gbEncrypt are very similar. I could have combined the code
for those three actions, but decided it was easier to debug/maintain if I kept the code separate
for each.
Comments and suggestions are welcome!
|