To encrypt a bash script install the shc download from
http://www.datsi.fi.upm.es/~frosal/ .
To encrypt a folder read the encfs, to encrypt files
read this article.
GNUpg is a utility that encrypt the files and disk images, to encrypt the folder first compress it with the tar and
bzip2 then encrypt the archives with GNU gpg, install the gpg with with aptitude.
apt install gnupg
gnu gpg working as user base unless you share the key with others, for this first create your own key pairs:
gpg –gen-key
Follow the insructions when complete you will see the following message:
gpg: key BB599FA8 marked as ultimately trusted
public and secret key created and signed.
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
pub 2048R/BB599FA8 2013-05-05
Key fingerprint = 47AD 5E09 0430 1738 A163 13E5 DF22 7039 BB59 9FA8
uid user (This is user gpg keys with mail [email protected])
sub 2048R/7FC66994 2013-05-05
Key ID: BB599FA8
Real Name: user
E-mail: [email protected]
Key fingerprint: 47AD 5E09 0430 1738 A163 13E5 DF22 7039 BB59 9FA8
gpg --list-keys
/home/shams/.gnupg/pubring.gpg
------------------------------
pub 2048R/BB599FA8 2013-05-05
uid user (This is user gpg keys with mail [email protected])
sub 2048R/7FC66994 2013-05-05
gpg -armor --output pubkey.txt --export shams or
gpg --armor --output pubkey.txt --export [email protected] or
gpg --armor --output pubkey.txt --export BB599FA8
gpg --send-keys --keyserver hkp://subkeys.pgp.net BB599FA8
gpg -ao mypub.key --export BB599FA8
This will create a file called “mypub.key”, to backup your Private key give the following command:
gpg -ao myprivate.key --export-secret-keys BB599FA8
Now store these two files (mypub.key and mypub.key) on a floppy disk, CD or USB drive and put it away to some secure and
safe place.
# gpg --output myrevoke.key --gen-revoke BB599FA8
and answer the few questions that will be presented to you, save this revocation key and a safe place.
gpg --import myprivate.key
gpg --import mypub.key
gpg --import myrevoke.key
Now we need to inform everybody on the Internet that we are revoking this key and people should not use this key to send you
messages. this can be done by informing the keyservers just like when we informed about your newly created public key.
To send the revoking information to the keyserver give the following command:
gpg ---send-keys --keyserver hkp://subkeys.pgp.net BB599FA8
Now anyone who tries to send you a message using your key which has NOW been revoked will get a message. However one needs to
refresh their GPG keyring database to get the latest information on the keys. Also it is a good idea to refresh your keys on a
regular basis so that you have up-to-date information. You can refresh your keys by following command:
gpg --refresh-keys --keyserver hkp://subkeys.pgp.net
gpg –delete-secret-and-public-key BB599FA8
The above command removes the key from the private and public keyring.
gpg --output doc.gpg --encrypt --recipient [email protected] doc
gpg -e -r user TEST.tgz
The -recipient option is used once for each recipient and takes an extra argument specifying the public key to
which the document should be encrypted. The encrypted document can only be decrypted by someone with a private key that
complements one of the recipients’ public keys. In particular, you cannot decrypt a document encrypted by you unless you
included your own public key in the recipient list.
gpg --output doc --decrypt doc.gpg
gpg -d -o TEST.tgz TEST.tgz.gpg