Makefile for basic PGP operations
This is a Makefile project for basic PGP (Pretty Good Privacy) operations
(keygen, export/import, encrypt/decrypt) utilizing the GnuPG (GNU Privacy Guard)
implementation in order to easily encrypt and decrypt files with sensitive
content.
Install GnuPG package on Debian/Ubuntu machine:
sudo apt-get install gnupg2
or for other OS download from GnuPG’s site and install:
www.gnupg.org/download/index.en.html
Generate private/public key pair interactively if there are no such yet
make keys
Keys are going to be stored under ~/.gnupg
in a key database protected
with the password given through the process of generation.
Keys might need to be ported to other systems. In order to port the whole key
database it is enough to copy the ~/.gnupg
directory to the target system.
To port only the keys of interest exporting and importing them is needed.
To do so set the UID
in the Makefile to the one whose keys are to be
ported and make export
. On the target machine with the same Makefile and
the exported keys along make import
.
To encrypt a file with the name filename
:
make filename.asc
To decrypt an encrypted file with the name filename.asc
and get back the
original one:
make filename
To decrypt all encrypted files *.asc
:
make plain
To clean directory from plain (sensitive) files by encrypting them if needed
and securely delete them:
make clean