EC-Crypt File Encryption Package Version 01
User Manual - November 13, 2012
1. EC-CRYPT FILE ENCRYPTION PACKAGE
EC-Crypt is a fast, easy-to-use package for encrypting data files.
Encrypting a file makes it impossible for someone else to read the file,
unless you give them the key. It may be used to encrypt any of your
personal files, including files that you may send to other people as
messages. It does a medium-security encryption that will withstand any
attack using a PC, even if your opponent is willing to devote years of
computing time to the task.
TABLE OF CONTENTS
1. EC-CRYPT FILE ENCRYPTION PACKAGE
1.1. Easy to use
1.2. Encrypting a file
1.3. Decrypting a file
2. INSTALLING EC-CRYPT
3. CRYPTO TRICKS
3.1. Key strength
3.2. Extended keys
3.3. Messages
3.4. Rename me
4. KEYS
4.1. Key Do's and Don'ts
4.2. Letters, digits and punctuation
4.3. Key blocks
4.4. Pronounceable keys
4.5. Patterns
4.6. Secretaries and clerks
4.7. Key strength
4.8. Summary: Picking a key
Appendix A. DOS BASICS
A.1. Starting DOS
A.2. Sizing the DOS window
A.3. Directories
A.4. Current directory
A.5. Working with directories
A.6. Identifying files
A.7. Long names
A.8. File operations
A.9. Batch files
1.1. Easy to use
The package is very simple to use. You just type ECCRYPT on the
command line, and you will be prompted for the key and the file name.
Let's go through the steps. The blue text is what you will see on your
screen. You type
eccrypt
and then press Enter. EC-Crypt will ask you what you want to do.
Do you wish to
E - Encrypt the file. Make it unreadable to protect it.
D - Decrypt the file. Make it readable to use it.
Q - Quit.
Type your choice (E, D, or Q):
To Encrypt a file you type E. To Decrypt a file you type D.
1.2. Encrypting a file
To encrypt a file you need to supply the key and the file name. If
your data is important, then it is important that you use a long and strong
key. There will be a whole chapter later about how to create a really
strong key. EC-Crypt will prompt you for the key.
The key may be any combination of up to 64 letters, digits,
and punctuation. The key is case-sensitive, so that
KEY Key key kEY
KeY KEy keY kEy
are all considered different keys. You may use letters, digits
and punctuation marks, such as + $ " and : All characters are taken
as part of the key, including leading and trailing blanks.
Enter the encryption key.
Key:
You type your key at the prompt. Be sure to check that you have typed it
accurately.
EC-Crypt has a valuable safety feature to help make certain that you
do not use the wrong key later, when you try to decrypt the file. This is
the verification code.
Your verification code is XXXX Record your
key and your verification code in a secure place.
Press Enter when ready.
The verification code will consist of 4 characters, which may be letters,
digits or punctuation, for example R7M2 or 3Z#H. Make sure that you write
down your encryption key and verification code, and keep them in a secure
place, for example, locked in a safe. Do not let anyone see the key, or
see where you put it.
Next you need to tell EC-Crypt which file to encrypt. You do not need
to be concerned about the format of the file. EC-Crypt can handle any file
in any format created by any program. You will be prompted for the file
name.
Enter the name of the file to be encrypted or decrypted,
or type Q to quit.
File name:
Type the name of your file and press Enter. For example, if you want to
encrypt the file munitions.list then you would type munitions.list like
this
Enter the name of the file to be encrypted or decrypted,
or type Q to quit.
File name: munitions.list
and then press Enter.
You can encrypt or decrypt as many files as you wish each time you use
EC-Crypt. You will see
Finished
Do you wish to encrypt or decrypt more files (Y or N):
If you have more files to encrypt or decrypt press Y for Yes, otherwise
press N.
1.3. Decrypting a file
Decrypting a file is the opposite process from encrypting the file.
You enter the same information as before.
Do you wish to
E - Encrypt the file. Make it unreadable to protect it.
D - Decrypt the file. Make it readable to use it.
Q - Quit.
Type your choice (E, D, or Q):
Type D to decrypt a file.
You give the key next, but the process is slightly different.
The key may be any combination of up to 64 letters, digits,
and punctuation. The key is case-sensitive, so that
KEY Key key kEY
KeY KEy keY kEy
are all considered different keys. You may use letters, digits
and punctuation marks, such as + $ " and : All characters are taken
as part of the key, including leading and trailing blanks.
Enter the encryption key.
Key:
After you type the key EC-Crypt will respond
The verification code is XXXX
Is this the correct code?
Y = Yes, N = No, Q = Quit:
Make sure this verification code matches the code you got when you
encrypted the file, such as R7M2 or 3Z#H. If the code does not match, then
you typed the encryption key incorrectly. Press N for No. You will then
get another chance to type the key correctly.
Do not decrypt the file with the wrong key. If you do that, then you
might lose the file permanently. You must always type the encryption keys
carefully and accurately, and check the verification code every time.
Once you have checked that the verification code is correct, you give
the file name just as above.
Enter the name of the file to be encrypted or decrypted,
or type Q to quit.
File name:
Type in the file name and press Enter. EC-Crypt will decrypt your file,
and then prompt you for more files, just as before.
2. INSTALLING EC-CRYPT
EC-Crypt will be sent to you as a single zip file. Download the file,
unzip it, and copy the internal files into the folder (directory) where you
want to use it. Or, copy it first and then unzip it. That's it. EC-Crypt
comes ready to use. There is no further setup.
If you plan to use EC-Crypt for several different types of documents,
you can copy it into each folder so you have a local copy. Then you don't
need to specify a path when you start EC-Crypt. You can have as many
copies as you like. They are all compatible. They will not interfere with
one another. You can encrypt a file using one copy of EC-Crypt and decrypt
it with another copy.
Speaking of copies, be sure you put a copy of EC-Crypt on every one of
your backup disks, flash drives, memory cards or other external storage
devices. If you use the Cloud for backup, and especially if you have
automatic backup to the Cloud, do not put a copy of EC-Crypt or any file
you intend to encrypt, or any file that you have already encrypted on the
Cloud. These files should be backed up only to storage devices that you
keep in your personal possession.
3. CRYPTO TRICKS
You can make your files more secure if you know a few Crypto Tricks.
You may need these tricks if your opponents have some expertise, or if they
can devote time on mainframe computers to breaking into your files. You
will definitely want these tricks if your opponents could steal your
computer or secretly copy your hard drive or backup devices.
3.1. Key strength
You need to pay some attention to how long and strong to make your
key. To get the full power of EC-Crypt, we recommend that you choose a key
equivalent to 80 binary bits. If your key consists of randomly chosen
decimal digits, you should use a 25-digit key, such as
40591 27360 14186 52694 37529
If you are using a key of randomly chosen capital letters you will want a
key 17 letters long, such as
PRTNCI GRUYAV LHUOZ
If your key consists of mixed digits, upper and lower case letters and
punctuation, that is, you are using all of the characters on the keyboard,
then 13 characters are enough, say
K=dL4 2MaZ 5:1"
The chapter on choosing keys will give you more ideas, but keep in mind
that you are shooting for 80-bit key strength.
3.2. Extended keys
There will be a full chapter about keys later in this manual. If your
likely opponents are not crypto experts, you can just choose one long and
strong key and use it for all of your files. You can memorize the key, so
you never write it down, and your opponent can never find it. However, if
you are facing a sophisticated enemy, you do not want to have many files
all encrypted with the same key. That gives your opponent more material to
work with.
One solution is to use key extensions. Suppose your chosen key is
KmR637-DgF452-WcN608 and you are encrypting a file named NewStoreLocations.
You could add part or all of the file name to make the specific key for
that file, for example KmR637-DgF452-WcN608-NSLoc. The downside of this
method is that you must not rename the file. If you do need to rename it,
you must decrypt it first, change the name, then encrypt it again using the
new name and key, say KmR637-DgF452-WcN608-CookieRecipe.
3.3. Messages
If you are using EC-Crypt to encrypt messages that you are sending to
and from another party, you need to give that other person the message key.
This should be a different key from the ones that you use to encrypt files
on your own computer. You probably don't want to give that person a
separate key for every message, yet it is less secure if you encrypt every
message with the same key.
One solution is to use message numbers, also called sequence numbers
or message codes. The first message you send could be called 0001, the
second one 0002, and so forth. These codes do not need to be secret. You
can put the sequence number right in the subject line of an email, and
attach the message as a file.
Suppose your key for communicating with your partner is LMSVT 29504
QGVXO 68139. When you send message 0006, you add the sequence number in
some agreed format to the key. So the key for message 0006 might be LMSVT
29504 QGVXO 68139 :0006.
3.4. Rename me
A simple trick to use if you are hiding your files from people who
might be in, or come into, your home or office is to rename all of the
EC-Crypt files to other innocent-sounding names. For example, you might
rename ECCRYPT.EXE to CALENDAR.EXE or NOTEBOOK.EXE. It is a good idea to
use a name that people would expect to find on your computer. For example,
if you are known to be a coin collector, you might rename it to
CoinList.exe, or CoinPal.exe or BestCoins.exe.
Rename the other EC files accordingly. If you want to be
ultra-thorough, go into the EC-Crypt manual and change every place that it
says crypt to something else. That way, if your opponent searches your
computer for references to encryption they won't find them in the EC files.
They won't have a starting point for trying to break the encryption.
4. KEYS
Choosing the keys for encrypting your files is one of the most
critical steps in using the EC-Crypt package. If you choose a short or
weak key, it may be easy to remember and easy to type each time you need
it, but your data will not be secure. It is a serious mistake to think
that you can use a weak key simply because you are using such a strong
encryption package. A strong safe with a weak lock is not secure.
If you choose a long strong key your data will be more secure, but it
will be harder for you to remember it and to type it accurately each time
it is needed. This chapter will describe techniques for choosing keys that
are both secure and easy to remember and to type accurately.
4.1. Key Do's and Don'ts
Many people try to take shortcuts in order to have keys that are easy
for them to remember. You need to assume that any opponent will also be
aware of the same shortcuts. Here are some simple rules that can help
prevent a costly error.
When you choose a key, do not base the key on your personal
information. Assume that your opponent knows all of your personal data.
DO NOT base your key on
Your birthday
Your telephone number
Your Social Security number
Your license plate number
Your spouse's, child's, parent's, sibling's or even
your pet's name, birthday, phone number, etc.
DO NOT base your key on commonplace phrases
Nursery rhymes
Song titles or lyrics
Folk sayings
Names of famous people, groups, places or events
Names of books, plays or TV shows
Punchlines from jokes
Well-known dates
Tongue twisters
Words or phrases in other languages
DO NOT use data widely known within your specialized field
Digits of pi or e
Names of bones, nerves, or organs
Names of stars, minerals, geological features, bacteria,
ancient cultures, alloys, proteins, theorems, etc.
Mnemonics
Names of people, schools, companies, places, etc.
The speed of light, Avogadro's number, the Golden Ratio, etc.
DO NOT choose sequences of consecutive letters from the alphabet or from
the keyboard, whether forwards, backwards or diagonally.
DO NOT use the keys that appear in this manual. Always assume that your
opponent has read it, too.
DO use a long key.
DO try to make your key as random as possible.
DO read this entire chapter on picking keys.
DO evaluate the strength of your key according to the principles in the
following sections.
DO make your Master Key extra long and strong.
4.2. Letters, digits and punctuation
If there are several people who need access to the data, and who are
trusted with the keys, then the problem of recording or memorizing the keys
becomes multiplied. Some people have the capacity to memorize long strings
of random-looking letters and/or digits, but most people cannot do this.
The safest course is to write down your key, and keep it in a secure place,
such as a locked safe. Other techniques will be discussed in a later
section. It is advisable to have several copies, in case one copy gets
lost, stolen or destroyed.
The strength of an encryption key is measured in bits, the binary
digits that are used by your computer's hardware. Here is a rough guide to
how many bits you get from each character in an encryption key when the
characters are chosen randomly.
Table 1. Strength of each character in a key.
Decimal digits = 3.3 bits
Single case letters = 4.7 bits
Mixed case letters = 5.7 bits
Mixed letters and digits = 5.9 bits
Mixed letters, digits and punctuation = 6.3 bits
Based on this chart, here is the strength of some sample 10-character keys
Table 2. Strength of 10-character blocks.
5835701483 = 33 bits Decimal digits
CIWMRPTNZX = 47 bits Upper case letters
tyuhbivxks = 47 bits Lower case letters
DmbHaqREkV = 57 bits Mixed case letters
ku8Je94Lg7 = 59 bits Mixed letters and digits
g"p5WZc4%F = 63 bits Mixed letters, digits, punctuation
As you can see, the strength of the key increases when you choose
randomly from a larger set of characters. However, the difficulty of
memorizing the keys and typing them accurately becomes much greater as the
keys get more random.
Note that all of the keys illustrated above are too short to be
considered secure.
4.3. Key blocks
There are several methods for producing keys that are secure, yet
easier for people to manage. The first technique is to break your keys
into blocks. It has been a common practice for many years to break coded
messages into blocks of 5 characters each so that they can be transcribed
more accurately. The same idea works for keys, too. Notice how the key
CNWIALVMXBTEPOSBXRNH
becomes much easier to read when it is broken into groups of 5 letters
CNWIA LVMXB TEPOS BXRNH
For longer keys it may be advisable to use additional punctuation to
organize the blocks into groups of blocks. For example,
48591-04528-16392, 35207-31654-74925, 09482-71653-42570
GBXTL=PRBUI=LVZEW..BXGMN=LUIQT=SPFAE..VZJOQ=HUKBW=OZCND
The second technique is to use groups that have the same structure.
Here are some examples, and the strength of each key block
91486 61872 94373 16 bits per block 5 digits
T3708 D6204 F5193 18 bits per block 1 letter, 4 digits
GS437 BR092 LX528 19 bits per block 2 letters, 3 digits
UHM15 XTN63 MYA74 21 bits per block 3 letters, 2 digits
QRILC PJRMS OVDZK 23 bits per block 5 letters
The strength remains the same when the letters are placed in different
positions. For example, all of the following keys have the same strength,
namely 2 letters and 3 digits
GS437 BR092 LX528 Letters at the start of each block
943KP 471GQ 205YL Letters at the end of each block
V107J X219C F738L Letters at both ends of each block
6WF52 9TU48 7JN13 Letters in the middle of each block
One advantage of using key blocks that always have the same structure
is that there is no confusion between letters and digits. Some letters and
digits that may get confused are
Letters B G I l O S T Z
Digits 8 6 1 1 0 5 7 2
Its position in the block tells you whether the character is a letter or a
digit, so there is no need to avoid these characters when you use blocks
with a fixed structure.
Another variation on this idea is to make each key block uniform, but
to vary the types of blocks randomly. Here are two 30-character keys with
uniform blocks. Each block consists of all digits, or all uppercase
letters, or all lowercase letters.
KNUHW 50258 fewrz 39274 gyakf obqnk
doztc 81463 69917 AGNDL rdefo PUIZH
4.4. Pronounceable keys
Another technique that can be used to produce keys which are secure,
yet easy to remember, is to make the keys pronounceable. That is, you
would use pronounceable combinations of vowels and consonants to form
syllables, and combine these syllables to form artificial words. This
method may be valuable in situations where it is unsafe to write down the
keys, and they must be memorized. Here are some examples.
shambu dilp prelec oltu domex sarbuti shum obior
Yotz doruc flean jadmek pra kerazi, Lagatu limbrazon.
You can burn the key into your memory by starting with just a few
artificial words, say DOZEK ULM HAPLICO, and repeat these to yourself for a
day or two. Then add another few words, say DOZEK ULM HAPLICO GRUX ANTIAM,
and repeat those in your head for a few more days. You can add some more
words the following day.
dozek ulm haplico grux antiam ludovesk gur amesqi
You can complete the process by adding capitalization and punctuation,
like
Dozek ulm Haplico "Grux Antiam" ludo-vesk gur a'mesqi.
Using mixed-case letters and punctuation increases the strength of your
key.
You can imagine the key to be a saying in some private language, and
make up a translation, in order to fix it more firmly in your mind. For
example,
Wise king Haplico "Lion of Antioch" out-witted a sorcerer.
In a pronounceable key each letter has a strength of about 3.3 bits if
the words are fairly uniform in length, and about 3.5 bits if the words are
more variable in length. For example, the first key below is fairly
uniform in length, while the second is more variable.
panek dilbap greho drung fasdop ulben bukty crivan
lobykar elb dixiat glem urbiqeo dhorsh uz vilagump
4.5. Patterns
When choosing a key, avoid creating any patterns, such as repeated
letters or syllables. Patterns weaken the keys by making them easier to
guess. Here are some examples of keys with patterns.
BBXXTT KKUUVV WWYYCC The letters are all in pairs.
aaa3gg5yyyy9ccc7uu2 There are runs of equal letters.
10704 20906 50803 The second and fourth digit in
each group is zero.
51615 38183 29092 Each group has an ABCBA pattern.
zampana reveske flogoto The vowels in each group are all
the same.
tuntam memescu saksoli The first and second syllable
start with the same letter.
debendik devogi delakt Every group starts with de.
ABC ghi LMN def XYZ Each group has 3 consecutive
letters of the alphabet.
500XD 711TJ 822GN The second and third digits in
each group are the same.
31734 23839 30376 Every group has two 3's.
dobaku levoti wafigo Consonants and vowels alternate.
vgy7 2wdc zse4 7ujm Has diagonal runs on the keyboard.
KAZ VEK CIF ZOP HUQ The vowels run in order AEIOU.
Once you have chosen a key, inspect it for patterns, and change it to
remove them. If your key is a long string of letters or digits, look to
see if there are any letters or digits that are used too often, or that are
missing. You may want to make some changes. However, don't overdo it. If
you use every letter or every digit exactly the same number of times, or if
all the letters and digits in each block of your keys are always different,
those are also patterns which weaken the key.
4.6. Secretaries and clerks
Sometimes lower-echelon employees will not safeguard file keys as
zealously as other workers. It is common for these employees to write down
keys in places that are easily accessible, such as on the computer itself,
on their desk pads or wall calendars, or on slips of paper on a bulletin
board. Anybody could see the keys and write them down. It is absurd for
the company president to keep the Master Key in a locked box inside a
walk-in vault, and for the secretary's assistant to write the Master Key on
a gummed label on the wall next to the computer.
The employee might assume that nobody will ever guess that those
cryptic letters and digits are actually the Master Key that unlocks all of
the company's secret files. The employee might assume incorrectly. If
these employees must be trusted with the keys then it is essential that
they be educated to avoid such security breaches.
Keys should never be written or pasted on the computer itself, the
computer desk, a desk pad or calendar, the cover of a notebook or steno
pad, the bottom of a stapler, telephone or flowerpot, the back of a
clipboard, letter tray or desk organizer, or any similar place. Intruders
know to look in such places. Don't make their job easy.
4.7. Key strength
The following table is a guide to how long a key must be in order to
achieve various levels of security. For example, if you want a key
strength of 200 bits, and you use a decimal key, then you need 60 digits.
With the speed of current computers 100 bits is the lowest level of
security that can be considered safe.
The table assumes that the letters or digits of the key are chosen
completely randomly. If the letters or digits follow some pattern then
your key needs to be longer. For example, a key such as
TC174 JF296 BH583 KD629
would be measured as 8 single-case letters and 12 digits, for a total
strength of 77 bits. Because of the LLDDD pattern it would not be
considered to be 20 mixed letters and digits, which would have a strength
of 118 bits.
Table 3. For each type of key, this table shows how long to make
the key in order to achieve the desired strength.
Desired key strength measured in bits
Type of key 100 125 150 200 250 300 400
---------------------------------------------------------------
Decimal digits 30 38 45 60 75 90 120
Single-case letters 21 27 32 43 53 64 85
Mixed-case letters 18 22 26 35 44 53 70
S-C letters + digits 19 24 29 39 48 58 77
M-C letters + digits 17 21 25 34 42 50 67
Letters, digits, punc 16 20 24 32 40 47 63
Uniform blocks 22 27 33 44 55 66 88
Pronounceable, uniform 30 38 45 60 75 90 120
Pronounceable, variable 29 36 43 57 71 86 114
For example, if you wanted a decimal key you would read across the top row
of this table. If you wanted the decimal key to have a strength of 125
bits, you would look at the second column in the top row to find that you
would need 38 decimal digits. If you wanted a key of mixed-case letters
and digits with a strength of 250 bits, you would need 42 letters and
digits.
Note that the longest input line you can enter is 126 characters.
(This is a limitation of DOS, not a limit set by EC-Crypt.) So if you
wanted 400 bits of strength, and you chose to have a decimal key which
requires 120 digits, then you would have only 6 characters left to separate
the blocks. Your blocks would need to average over 17 characters each. (A
pattern of 17, 17, 17, 17, 17, 17, 18 would fit.)
4.8. Summary: Picking a key
The best way to pick a key is to follow these steps.
(1) Decide how strong you want your key to be, say 200 bits.
(2) Choose the type of key, say blocks of letters and digits.
(3) Use the tables above to determine the key length.
(4) Randomly choose a key of the required length.
(5) Inspect the key for patterns.
(6) Adjust the key to remove or reduce the patterns.
(7) If you will need the key again, write down the key and keep
a copy in a secure place.
(8) Type the key when EC-Crypt asks for it.
Appendix A. DOS BASICS
EC-Crypt runs under DOS, not under Windows. DOS was the primary
operating system for personal computers from about 1975 to 1995. Older
versions of Windows, prior to the introduction of Windows 95, ran as tasks
under DOS. Since 1995 the situation has reversed, and DOS now runs as a
task under Windows. Every computer user before 1995 knew DOS well.
However, newer computer users may not be familiar with DOS, so that a
little basic orientation may be helpful.
A.1. Starting DOS
On newer computers it may be difficult even to find DOS in order to
use it. There are two methods for running DOS. The first method is to
click on a DOS icon from your desktop, or from a taskbar at the top or
bottom edge of the desktop. The icon may say DOS, or MSDOS, or possibly
CMD or COMMAND. Clicking any one of these icons will start DOS. If there
is a DOS icon on your desktop or in a taskbar, you can skip the rest of
this section.
If there is no DOS icon on your desktop or taskbar you may find one
elsewhere. Start by clicking on "Start" in the corner of the screen. This
will bring up a menu listing various programs and options. If there is a
DOS icon there, you can use it directly, or you could drag it onto the
desktop for future use. If it is not there, click on "Programs" or "All
Programs." This will bring up a long list of various programs that are on
your computer. If one of these is DOS, you can click it, or you can drag
it to the desktop.
If you still don't see a DOS or CMD icon, put your mouse on each of
the icons that you see. Don't click, just let the mouse cursor rest on the
icon. This will often bring up another list of programs, and DOS may be
among them.
If DOS still is not there, don't give up. You just need to search
deeper. In the list of All Programs there will be some folders with names
such as "Applications" or "System Utilities." Click to open each of these
folders. In those folders you may find DOS or CMD. Or, you may find more
folders. Again, rest the mouse on the names of programs, and click on
folders to find even more well-hidden programs and folders.
Once you find the DOS icon, drag it to the desktop. Put the mouse
cursor on the DOS icon and hold down the left button. Move the mouse to
drag the cursor onto the desktop, and then release it to drop the icon on
the desktop. Click the desktop to close all of the other windows. Then
drag the DOS icon to wherever you want it on the desktop.
If all of this fails, it is time to try the second method. Go back to
the desktop, and click on "Start" again. In the list of options click on
"Run" or "Run Program." This will open a small window with a box where you
can type the name of a program that you wish to run. Type CMD in this box,
and then press Enter. This will open a DOS window.
A.2. Sizing the DOS window
The DOS window will often be a small window in the middle of the
screen, probably off-center. It is easier to work with DOS in full-screen
mode, with no distracting windows or borders. To do this, right click on
the top border of the DOS window, and select "Properties" from the pop-up
window that appears. Use the various options to select full-screen mode.
This may take several tries before it works, so don't get frustrated if the
next time you use DOS you get the same small window, and need to resize it
again.
When you do get the full screen mode, the screen is likely to be set
to 50-line mode. This makes the characters small and crudely formed. You
may be more comfortable using 25-line mode. To switch, you can type the
command
mode con lines=25
This will double the size of the characters and make them easier to read.
A.3. Directories
In DOS your computer's hard disk is organized into directories. All
of the files on your computer are in directories. These correspond to the
folders in Windows. Directories and folders are the same thing. A
directory or a folder can contain files and more directories or folders, so
that the folders or directories are nested one inside the other in a
hierarchy.
The top of the hierarchy is called the "root directory." Typically
the root directory does not contain any files. Rather, it contains all of
the principal directories on the computer, such as
\Windows
\Program Files
\Documents and Settings
and so forth. The backslash \ in front of these directory names shows that
they are directories within the root directory.
A directory within another directory is sometimes called a
subdirectory. In the example above the directory Windows would be a
subdirectory of the root directory.
A.4. Current directory
Files are identified in DOS by using a path, a filename and a
filetype. For example,
direc1\direc2\file1.doc
Here the path is direc1\direc2, the filename is file1 and the filetype is
doc. The path consists of the sequence of nested directories which contain
the desired file.
If the path starts with a \ backslash, then the sequence of
directories start from the root directory. If the backslash is omitted,
then the path starts from the current directory. For example, if the
current directory is Windows, then the file identifier
direc1\direc2\file1.doc would refer to the file
\Windows\direc1\direc2\file1.doc
By setting the current directory you can shorten the names of programs
and files that you must type. For example, if you want to use the program
\direc1\direc2\prog1.exe
to process the data files
\direc1\direc2\file1.dat
and
\direc1\direc2\file2.dat
you could type
\direc1\direc2\prog1 \direc1\direc2\file1.dat \direc1\direc2\file2.dat
If you changed the current directory to \direc1\direc2 then this could be
shortened to
prog1 file1.dat file2.dat
The command to change the current directory is cd. To change the
current directory to \direc1\direc2 you would type
cd \direc1\direc2\
If you later wanted to change the current directory to
\direc1\direc2\direc3 it is sufficient to type
cd direc3
since you were already in the directory \direc1\direc2.
A.5. Working with directories
You can make your own directories by using the Make Directory command.
For example, if the current directory is \direc1\direc2 and you wanted to
make a subdirectory called direc3, then you could type
md direc3
Starting from the root directory, the new directory would be
\direc1\direc2\direc3.
To remove a directory, you can use the Remove Directory command. For
example, to remove the directory \direc1\direc2\direc3 you would type
rd \direc1\direc2\direc3
As a safety precaution, you cannot remove a directory until you have
deleted all of the files in the directory, and removed all of its
subdirectories. This prevents you from accidentally deleting files that
you meant to keep.
To list the contents of a directory, you can use the Directory
command. The basic format is
dir mydirec /options
Here mydirec is the directory you want to list. There are many possible
options. Here are a few of the most useful:
/s List the contents of all subdirectories
/on Sort the files by name
/os Sort the files, smallest to largest
/o-s Sort the files, largest to smallest
/od Sort the files, oldest to newest
/o-d Sort the files, newest to oldest
/p Pause after every 20 lines
You can use several options in the same command. For example,
dir \direc1 /s /od /p
would list the files in \direc1 and all of its subdirectories sorted from
oldest to newest, and pausing after every 20 lines.
You can also list specific files, files that have a given filename or
filetype, or files whose filenames and filetypes begin with specific
letters. Here are some examples
dir tax.ref Lists the file tax.ref.
dir tax.* Lists all files with the name tax.
dir *.doc Lists all files of type doc.
dir st*.c* Lists all files whose filename starts with st
and whose filetype begins with c, such as
startup.cfg, study.com or state.core.
The * asterisks in these commands are called wildcards because they can be
replaced by any set of letters. These commands can tell you whether these
files exist, their sizes, and the date they were last updated.
A.6. Identifying files
All of the data in your computer resides in files. Files contain the
operating system, all of the application programs, and all of the data that
they use and create. Files are identified to DOS by four fields, namely
the drive, path, filename and extension.
drive is the device where your file is stored, usually
C for your hard drive, A or B for a floppy drive,
D or E for a CDROM drive.
path is the directory on your drive where the file is
located.
filename is the name that you gave your file. The name
usually indicates the contents or purpose of the
file.
extension is a suffix that indicates the kind of file, such
as TXT for a text file, JPEG for a picture file,
EXE for an executable file, etc.
A full file identifier might look like this,
c:\mycompany\mydepartment\2005\sales.wp
In this example, c: identifies that your file is on the C drive, which
is your hard drive. \mycompany\mydepartment\2005\ is the path to your
data. It shows that the data file is located in the 2005 folder, which is
inside the mydepartment folder, in the mycompany folder. So the path
consists of nested folders, or a list of directories. sales.wp is the file
with the data. The filename is sales, and the extension is wp, which
indicates that it is a WordPerfect document.
In a file identifier all of the fields except the filename are
optional.
drive can be omitted if the file is on the current
drive, that is, the drive where you are now
working.
path can be omitted if the file is on the current
directory of the drive.
extension can be omitted if the file does not have an
extension on its name. For example, if the file
is just named oldstuff then no extension is
needed.
Here are some examples of valid file identifiers:
a:budget
identifies the file budget in the current directory
of the A drive.
\jones\commissions
identifies the file commissions in the jones directory
on the current drive.
late\requests.txt
identifies the file requests.txt in the late
subdirectory of the current directory.
A.7. Long names
Some Windows files and directories have long names, or names
containing blanks or dots, such as
Documents and Settings
My Music
Microsoft.Net
SharedReg12.dll
Microsoft has made the naming of files and directories incompatible between
Windows and DOS. DOS limits directory names to 8 characters, and does not
allow blanks in names.
To refer to these directories, you need to shorten the names down to 8
characters. The short name is formed by taking the first 6 non-blank
characters of the name plus the combination ~1. When the name of a
directory contains a . dot character, each of the parts of the name is
treated separately. For example, for the directories above,
Documents and Settings would be called Docume~1
My Music would be called MyMusi~1
Microsoft.Net would be called Micros~1.Net
SharedReg12.dll would be called Shared~1.dll
Thus a full path and file name such as
\Windows\Microsoft.Net\Framework\SharedReg12.dll
in DOS would be called
\Windows\Micros~1.Net\Framew~1\Shared~1.dll
It is a good idea to give all of your own files and directories names
that are compatible with DOS. The names should be no more than 8
characters long and should not contain blanks.
A.8. File operations
Besides the encryption and decryption operations that you perform
using EC-Crypt, it can be useful to know several other common file
operations.
There is no DOS operation to create a file. Files are created by
application programs such as word processors, picture editors,
spreadsheets, etc. Once created, files can be copied, renamed and deleted.
It is important to remember that encrypted files should not be
renamed, and files should not be copied into or out of a group of encrypted
files. It is safest to decrypt files before renaming or copying.
To copy a file to a new location, the command is
copy oldfile newfile
The old file and new file identifiers can be fully qualified, that is, they
may have drive, path, filename and filetype. So the copy command can be
used to copy files to other directories or to other drives.
Wildcards can be used in the copy command to copy groups of files.
For example, the command
copy \oldpath\*.doc \newpath\*.*
would copy all files of type doc from the \oldpath directory to the
\newpath directory.
The rename command works similarly to the copy command. The form is
ren oldfile newname
Here oldfile can be fully qualified, with drive, path, filename and
filetype. However, newname can have only a new filename and filetype.
There cannot be a new drive or new path because the file does not change
its location, only its name and/or type. For example,
ren target\x3*.jpg x4*.*
would rename all of the jpg files in the target directory that start with
x3 to start with x4.
The command to delete files takes the form
del file
Here, file can be a fully-qualified file identifier, with drive, path,
filename and filetype. It can also have wildcards so that you can delete
several files with a single command. For example,
del a:old*.*
would delete all files in the current directory of the a drive whose
filenames start with old.
Note that deleting a file does not erase it. The file still exists on
the disk, where it can be read by various utility programs that are
available for that purpose. The file will remain there until some other
file eventually gets written on top of it.
A.9. Batch files
Batch files are a useful way to reduce the number and complexity of
the DOS commands that you must type. Each batch file can contain any
number of DOS commands. You execute the entire sequence of DOS commands
just by typing the name of the batch file.
Here is a simple example. Suppose that you frequently use the program
EC-Crypt. If the current directory is \plans\tower but EC-Crypt is in the
directory \programs\download then to use EC-Crypt you would type
\programs\download\ECCRYPT
To make this easier, you could create a batch file named ECCRYPT.bat on the
current directory. This file would contain the single line
\programs\download\ECCRYPT
Now when you wanted to execute EC-Crypt all you would need to type is
ECCRYPT
You could place a copy of the batch file ECCRYPT.bat in every
directory where you usually work. Then you could run EC-Crypt from
anywhere just by typing ECCRYPT. You would not need to have multiple
copies of EC-Crypt.
There are many other DOS commands and options. This is just a small
sample of useful DOS commands.
Back to EC-CRYPT main page
Back to MASTER SOFTWARE CORPORATION homepage
Choosing an Encryption Product
A Quick Overview of Cryptography
© Copyright 2012 Frank Rubin
All rights reserved. No part of this manual may be reproduced
in any form without the express permission of the author.