Skip to content

Instantly share code, notes, and snippets.

@jmusits
Created January 13, 2017 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmusits/955838c68c843e69b0e0411e3c16840e to your computer and use it in GitHub Desktop.
Save jmusits/955838c68c843e69b0e0411e3c16840e to your computer and use it in GitHub Desktop.
bash-3.2$ brew install gpg2
==> Downloading https://homebrew.bintray.com/bottles/gnupg2-2.0.30_3.el_capitan.bottle.tar.gz
Already downloaded: /Users/jmusits/Library/Caches/Homebrew/gnupg2-2.0.30_3.el_capitan.bottle.tar.gz
==> Pouring gnupg2-2.0.30_3.el_capitan.bottle.tar.gz
==> Using the sandbox
🍺 /usr/local/Cellar/gnupg2/2.0.30_3: 93 files, 3.7M
bash-3.2$ gpg --gen-key
gpg (GnuPG) 2.0.30; 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? 1
1 Script started on Fri Jan 13 10:24:39 2017
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 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) 10y
Key expires at Mon Jan 11 10:25:22 2027 EST
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Jason Musits
Email address: jmusits@skylight
Comment:
You selected this USER-ID:
"Jason Musits <jmusits@skylight>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
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: 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
gpg: next trustdb check due at 2027-01-11
pub 4096R/7389E024 2017-01-13 [expires: 2027-01-11]
Key fingerprint = CC5A 4A07 775A 6D48 0B3F 4B29 2806 B8AE 7389 E024
uid [ultimate] Jason Musits <jmusits@skylight>
sub 4096R/6BF7B173 2017-01-13 [expires: 2027-01-11]
bash-3.2$ gpg --keyserver pgp.mit.edu --send-keys 7389E024
gpg: sending key 7389E024 to hkp server pgp.mit.edu
bash-3.2$ exit
Script done on Fri Jan 13 10:26:51 2017
@szgaljic
Copy link

szgaljic commented Sep 27, 2017

On Linux (specifically Fedora 25)

$ gpg2 --version
gpg (GnuPG) 2.1.13
libgcrypt 1.7.8
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /home/szgaljic/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

$ gpg2 --full-gen-key
generate your key as described above

$ gpg2 --list-keys --keyid-format short
to get your short format key id for uploading to MIT

$ gpg2 --keyserver pgp.mit.edu --send-keys keyid
gpg: sending key keyid to hkp://pgp.mit.edu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment