File Encryption with GPG
1. Installation and generating public/private key pair
Encription method:
It uses asysmmetric encription, what that mean is encription is using a matched pair of encripted
private and public keys. They are mathmetically created algorithm at the same time. The public
key is given to the end user who wants to have a secure transfer of information with the creator
of the public key. End user encript the information with the public key and sends over the
network on the other end where ower of the key will decript the information using his/her private
key. Sometimes, owner can use symetric key (kind of password) to create a public key where end
user has to use it while encripting the messag/file.
Package need to install
crypto-util
Create users and install packages
a. login as a root and create three accounts.
# useradd jay; useradd surya;useradd chandra
b. Install crypto-util paclage
# yum install crypt* -y
c. Now, log out and login as jay and generate a key using pgp -gen-key command.
$ gpg --gen-key
Note: gpg can create different types of keypairs.
just go through and select the default options for practice.
d. List your keys
$ gpg -list-keys
e. Export your public key
$ pgp -armor -export >/var/tmp/jay.key
Note: public key extention should be .key
f. Now, login as a user surya and import the public key generated by Jay.
$ gpg -import /tmp/jay.key; gpg -list-keys
2. Encripting/decripting a file.
Plan: now, surya will encript a file using jay's public key and jay will decript the message that surya sends to jay using the private key.
a. Encript your file.
$ tail -2000 /var/log/messages >/var/tmp/myfile.txt
b. Now, encript the file myfile.txt with jay's public key.
$ gpg -encript -armor -recipient jay@sama.expanor.local myfile.txt
just follow the prompt and your message is encripted.the extenstion is now myfile.txt.asc.
now, copy the message file with proper permission so that jay can access it.
c. login as user jay and decript the message. It will prompt you for password.
$ gpg -decrypt myfile.txt.asc
d. Now, login as chandra and see if you can read the message.
Of course you can't read it because you are now the owner of the private key and you don't have it. to encript the message, you should be owner or should have private key to decript the key.
1. Installation and generating public/private key pair
Encription method:
It uses asysmmetric encription, what that mean is encription is using a matched pair of encripted
private and public keys. They are mathmetically created algorithm at the same time. The public
key is given to the end user who wants to have a secure transfer of information with the creator
of the public key. End user encript the information with the public key and sends over the
network on the other end where ower of the key will decript the information using his/her private
key. Sometimes, owner can use symetric key (kind of password) to create a public key where end
user has to use it while encripting the messag/file.
Package need to install
crypto-util
Create users and install packages
a. login as a root and create three accounts.
# useradd jay; useradd surya;useradd chandra
b. Install crypto-util paclage
# yum install crypt* -y
c. Now, log out and login as jay and generate a key using pgp -gen-key command.
$ gpg --gen-key
Note: gpg can create different types of keypairs.
just go through and select the default options for practice.
d. List your keys
$ gpg -list-keys
e. Export your public key
$ pgp -armor -export >/var/tmp/jay.key
Note: public key extention should be .key
f. Now, login as a user surya and import the public key generated by Jay.
$ gpg -import /tmp/jay.key; gpg -list-keys
2. Encripting/decripting a file.
Plan: now, surya will encript a file using jay's public key and jay will decript the message that surya sends to jay using the private key.
a. Encript your file.
$ tail -2000 /var/log/messages >/var/tmp/myfile.txt
b. Now, encript the file myfile.txt with jay's public key.
$ gpg -encript -armor -recipient jay@sama.expanor.local myfile.txt
just follow the prompt and your message is encripted.the extenstion is now myfile.txt.asc.
now, copy the message file with proper permission so that jay can access it.
c. login as user jay and decript the message. It will prompt you for password.
$ gpg -decrypt myfile.txt.asc
d. Now, login as chandra and see if you can read the message.
Of course you can't read it because you are now the owner of the private key and you don't have it. to encript the message, you should be owner or should have private key to decript the key.
No comments:
Post a Comment