How to use GPG(GnuPG)

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-gpggnupg/
PINTEREST
PINTEREST
INSTAGRAM

GnuPG or GPG is Gnu version of Open PG standart implementation. It is very popular especially at personal use for mails etc. Here I will look basic usage of gpg2 in linux cli. gpg2 is the second major version of gpg.

Here we will create public and private keys for keyring. Required information asked while certificate generation process. Real name and Email address is given by user and then to encrypt these public and private keys and password is created
[ismail@dell gpg]$ gpg2 --gen-key
gpg (GnuPG) 2.1.7; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Note: Use "gpg2 --full-gen-key" for a full featured key generation dialog.GnuPG needs to construct a user ID to identify your key.Real name: İsmail Baydan
Email address: ismailbaydan@ismailbaydan.com
You are using the 'utf-8' character set.
You selected this USER-ID:
"İsmail Baydan <ismailbaydan@ismailbaydan.com>"Change (N)ame, (E)mail, or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 388E4120 marked as ultimately trusted
gpg: directory '/home/ismail/.gnupg/openpgp-revocs.d' created
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: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2u
pub rsa2048/388E4120 2015-09-03
Key fingerprint = 2AA8 B153 C6B7 7DE2 8012 5E6A 9DE4 1FB5 388E 4120
uid [ultimate] İsmail Baydan <ismailbaydan@ismailbaydan.com>
sub rsa2048/BFE69B6D 2015-09-03
It can be autocompleted by using tab as you can see in first command. In the second command we list existing public keys in keyring.
[ismail@dell gpg]$ gpg2 --list-key
--list-key --list-keys
[ismail@dell gpg]$ gpg2 --list-keys
/home/ismail/.gnupg/pubring.gpg
-------------------------------
pub rsa2048/32F2E832 2015-09-02
uid [ultimate] ismail (asd) <asd@asd.com>
sub rsa2048/0D1E6B0E 2015-09-02pub rsa2048/388E4120 2015-09-03
uid [ultimate] İsmail Baydan <ismailbaydan@ismailbaydan.com>
sub rsa2048/BFE69B6D 2015-09-03
To sign the data with the specific key not default. Here the –default-key parameter is looked in keyring in fingerprint, name, email etc. If you want signature apart from data use -b option.
[ismail@dell gpg]$ gpg2 --default-key Baydan -s test
[ismail@dell gpg]$ file test.gpg
test.gpg: data
To see private keys and  related info like fingerprint
[ismail@dell gpg]$ gpg2 --list-secret-keys
/home/ismail/.gnupg/pubring.gpg
-------------------------------
sec rsa2048/32F2E832 2015-09-02
uid [ultimate] ismail (asd) <asd@asd.com>
ssb rsa2048/0D1E6B0E 2015-09-02sec rsa2048/388E4120 2015-09-03
uid [ultimate] İsmail Baydan <ismailbaydan@ismailbaydan.com>
ssb rsa2048/BFE69B6D 2015-09-03
 But how to verify a signed pgp file?
[ismail@dell gpg]$ gpg2 --verify test.gpg
gpg: Signature made Prş 03 Eyl 2015 16:55:07 EEST using RSA key ID 388E4120
gpg: Good signature from "İsmail Baydan <ismailbaydan@ismailbaydan.com>" [ultimate]
To export existing keyring and use in other systems.
[ismail@dell gpg]$ gpg2 --export > deneme
[ismail@dell gpg]$ file deneme
deneme: GPG key public ring
[ismail@dell gpg]$ gpg2 --import deneme
gpg: key 32F2E832: "ismail (asd) <asd@asd.com>" not changed
gpg: key 388E4120: "İsmail Baydan <ismailbaydan@ismailbaydan.com>" not changed
gpg: Total number processed: 2
gpg: unchanged: 2
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-gpggnupg/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  How To Avoid Not Signed Error For Yum

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)