Last active
August 29, 2015 14:18
-
-
Save jsarenik/4141f5e6169bfbfac85b to your computer and use it in GitHub Desktop.
GPG tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install gnupg | |
... | |
$ gpg --gen-key | |
gpg (GnuPG) 1.4.19; 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. | |
Please select what kind of key you want: | |
(1) RSA and RSA (default) | |
(2) DSA and Elgamal | |
(3) DSA (sign only) | |
(4) RSA (sign only) | |
Your selection? ^C | |
gpg: Interrupt caught ... exiting | |
$ clear | |
$ gpg --gen-key | |
gpg (GnuPG) 1.4.19; 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. | |
Please select what kind of key you want: | |
(1) RSA and RSA (default) | |
(2) DSA and Elgamal | |
(3) DSA (sign only) | |
(4) RSA (sign only) | |
Your selection? | |
RSA keys may be between 1024 and 4096 bits long. | |
What keysize do you want? (2048) | |
Requested keysize is 2048 bits | |
Please specify how long the key should be valid. | |
0 = key does not expire | |
<n> = key expires in n days | |
<n>w = key expires in n weeks | |
<n>m = key expires in n months | |
<n>y = key expires in n years | |
Key is valid for? (0) 3y | |
Key expires at Fri Mar 30 11:19:15 2018 CEST | |
Is this correct? (y/N) y | |
You need a user ID to identify your key; the software constructs the user ID | |
from the Real Name, Comment and Email Address in this form: | |
"Heinrich Heine (Der Dichter) <[email protected]>" | |
Real name: Apiary Bee <[email protected]> | |
Invalid character in name | |
Real name: Apiary Bee | |
Email address: [email protected] | |
Comment: SRE Bee | |
You selected this USER-ID: | |
"Apiary Bee (SRE Bee) <[email protected]>" | |
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o | |
You need a Passphrase to protect your secret key. | |
passphrase not correctly repeated; try again. | |
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 031E6AFE marked as ultimately trusted | |
public and secret key created and signed. | |
gpg: checking the trustdb | |
gpg: public key of ultimately trusted key 00D026C4 not found | |
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model | |
gpg: depth: 0 valid: 3 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 3u | |
gpg: next trustdb check due at 2015-12-05 | |
pub 2048R/031E6AFE 2015-03-31 [expires: 2018-03-30] | |
Key fingerprint = E48A 547B DBB2 BC2B 6997 85B2 44BD 6B68 031E 6AFE | |
uid Apiary Bee (SRE Bee) <[email protected]> | |
sub 2048R/DA6787F4 2015-03-31 [expires: 2018-03-30] | |
$ gpg -a --export [email protected] > bee_public_key.asc | |
$ gpg --output bee_revoke.asc --gen-revoke [email protected] | |
sec 2048R/031E6AFE 2015-03-31 Apiary Bee (SRE Bee) <[email protected]> | |
Create a revocation certificate for this key? (y/N) y | |
Please select the reason for the revocation: | |
0 = No reason specified | |
1 = Key has been compromised | |
2 = Key is superseded | |
3 = Key is no longer used | |
Q = Cancel | |
(Probably you want to select 1 here) | |
Your decision? 3 | |
Enter an optional description; end it with an empty line: | |
> | |
Reason for revocation: Key is no longer used | |
(No description given) | |
Is this okay? (y/N) y | |
You need a passphrase to unlock the secret key for | |
user: "Apiary Bee (SRE Bee) <[email protected]>" | |
2048-bit RSA key, ID 031E6AFE, created 2015-03-31 | |
ASCII armored output forced. | |
Revocation certificate created. | |
Please move it to a medium which you can hide away; if Mallory gets | |
access to this certificate he can use it to make your key unusable. | |
It is smart to print this certificate and store it away, just in case | |
your media become unreadable. But have some caution: The print system of | |
your machine might store the data and make it available to others! | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment