Solved

How to Create a GPG Key

Posted on 2012-03-20
2
853 Views
Last Modified: 2012-03-26
Step by step, how do i create a free GPG key
0
Comment
Question by:deklinm
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Article by: btan
Provide an easy one stop to quickly get the relevant information on common asked question on Ransomware in Expert Exchange.
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now