Install gnupg in Cygwin
First step is to install gnupg in Cygwin. Run setup.exe and use all default until you get to select packages. In the search type gnupg click on install then at bottom of screen click next to install. There are two Website that are good reads on the topic of GPG .
Generate a private key
You’ll have to answer a bunch of questions:
What kind and size of key you want; the defaults are probably good enough.
How long the key should be valid. You can safely choose a non-expiring key for your own use. If you plan to use a key for public signing, you might want to consider a yearly expiration.
Your real name and e-mail address; these are necessary for identifying your key in a larger set of keys.
A comment for your key, perhaps to distinguish a key used for special tasks like signing software releases. The comment can be empty.
A passphrase. Whatever you do, don’t forget it! Your key, and all your encrypted files, will be useless if you do.
Export a key
After you generated a key, export it to a file so you can send in email or save on thumb drive.
gpg --armor --output pubkey.txt --export 'firstname.lastname@example.org'
Import a key
Import your friend’s key, which you might have received via e-mail or on a thumb drive. If the file is named pubkey.txt, then just use the –import option to add it to your keyring:
gpg --import pubkey.txt
Encrypt a file called sensitive.txt. The argument to the –recipient option should be the all or part of the name you used when generating your private key. The –output option is the name you want the gpg file called. Most likely you won’t need the –output option because it default to filename.gpg.
gpg --output sensitive.txt.gpg --encrypt --recipient email@example.com sensitive.txt
If someone sends you an encrypted file, the file has typically been encrypted using your public key. Decrypting it is no different than decrypting a file you have encrypted for your own use.
gpg --output sensitive.txt --decrypt sensitive.txt.gpg
# example Makefile for viewing/editing an encrypted file GPGID = 'your.email.com' FILEPLAIN = sensitive.txt FILECRYPT = $(FILEPLAIN).gpg GPG = gpg RM = rm -i VI = notepad TOUCH = touch all: @echo "" @echo "usage:" @echo "" @echo "* make touch -- Startup" @echo "* make view -- to see $(FILEPLAIN)" @echo "* make edit -- to edit $(FILEPLAIN)" @echo "" edit: @umask 0077;\ $(GPG) --output $(FILEPLAIN) --decrypt $(FILECRYPT) @$(VI) $(FILEPLAIN) @umask 0077;\ $(GPG) --encrypt --recipient $(GPGID) $(FILEPLAIN) @$(RM) $(FILEPLAIN) view: @umask 0077; $(GPG) --decrypt $(FILECRYPT) touch: # Run first if FILEPLAIN doesn't exist @umask 0077;\ $(TOUCH) $(FILEPLAIN) $(VI) $(FILEPLAIN)
Here is Makefile for download copy to your Cygwin home directory. Download Now! You must edit and fill in email address which was enter when you made key. To run just type:
usage: * make touch -- Startup * make view -- to see sensitive.txt * make edit -- to edit sensitive.txt
When running “make view” answer y to a couple of question when quitting.