Solved

How to Create a GPG Key

Posted on 2012-03-20
2
897 Views
Last Modified: 2012-03-26
Step by step, how do i create a free GPG key
0
Comment
Question by:deklinm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
IT-Shrek earned 250 total points
ID: 37745076
0
 
LVL 5

Assisted Solution

by:1ly4me
1ly4me earned 250 total points
ID: 37747015
You would need at least two systems to setup GPG key.
1. Main system (to hold private key)
2. Remote system (to have public key)

In the main system,
#gpg2 --gen-key
(The attached image shows the output of the above command)
You need enter some password for your private key.
It takes some time to generate key pair, so you can do some other work in the mean time.
To list keys,
#gpg2 --list-key
/root/.gnupg/pubring.gpg
------------------------
pub   2048R/91BE71BA 2012-03-21 [expires: 2012-05-20]
uid                  MyName (MY GPG Key Pair) <myname@exampl.com>
sub   2048R/3EF035BA 2012-03-21 [expires: 2012-05-20]

Now you can send the public key to remote system. First export the key and send
# gpg2 --export MyName > gpg.pub
# scp gpg.pub remote.IP.addr:
I used scp command to send, you can send public key via email, USB or any method.

On the remote system, run the following command
#gpg2 --list-key
If the system doesn't have any previous gpg keys, it should return empty output
Then import the exported key from the main system
#gpg2 --import gpg.pup
gpg: key 91BE71BA: public key "MyName (MY GPG Key Pair) <myname@exampl.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
#gpg2 --list-key
It will now list the imported key.
Next part is encrypting the file with public key,
#gpg2 --out test_encrypt.txt --recipient 'MyName' --encrypt test.txt
here the file test.txt is encrypted with public key of user MyName and the encrypted file will be named as test_encrypt.txt.
Then send that encrypted file to main system.
#scp test_encrypt.txt main.system.IP.addr:
Back on the main system,
decrypt the file with private key of user MyName,
#gpg2 --out mysecret.txt --decrypt test_encrypt.txt
You have to enter password for private key that you have setted up earlier.
(This decrypts the file test_encrypt.txt to file mysecret.txt)
Final review is you use only 4 commands to setup  GPG key pair
Main system
#gpg2 --gen-key
#gpg2 --list-key
#gpg2 --export MyName > gpg.pub
#scp gpg.pub remote.IP.addr:

Remote system
#gpg2 --import gpg.pup
#gpg2 --list-key
#gpg2 --out test_encrypt.txt --recipient 'MyName' --encrypt test.txt
#scp test_encrypt.txt main.system.IP.addr:

Main system
#gpg2 --out mysecret.txt --decrypt test_encrypt.txt

Open in new window

gpg.JPG
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most MSPs worth their salt are already offering cybersecurity to their customers. But cybersecurity as a service is wide encompassing and can mean many things.  So where are MSPs falling in this spectrum?
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question