random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

gpg.md (1648B)

      1 # GPG Cheat Sheet
      2 
      3 ## Create a key
      4 * `gpg --expert --full-generate-key`
      5 	* RSA (set your own capabilities)
      6 	* Set to Certify only
      7 	* 4096
      8 	* 2020-01-01
      9 * `gpg --expert --edit-key <userid>`
     10 	* `addkey` (Create 3, one for sign, encrypt, authenticate)
     11 	* `addphoto` *(240x288)*
     12 	* `save`
     13 	* `quit`
     14 * `gpg -a --output revoke.asc --gen-revoke '<fingerprint>'`
     15 
     16 ## Backup key
     17 * `gpg -a --export-secret-key     <userid> > secret_key.gpg`
     18 * `gpg -a --export-secret-subkeys <userid> > secret_subkeys.gpg`
     19 * `gpg --delete-secret-keys <userid>`
     20 * `gpg --import secret_subkeys.gpg`
     21 * `gpg --list-secret-keys`
     22 * `gpg --edit-key <KEYID>` *(type `trust` and press `5`)*
     23 
     24 ## Import/Export public key
     25 * `gpg --import public.key`
     26 * `gpg --output public.key --armor --export <userid>`
     27 * `gpg --export-secret-keys --armor <userid> > privkey.asc`
     28 
     29 ## List (secret) keys
     30 * `gpg --list-keys`
     31 * `gpg --list-secret-keys`
     32 
     33 ## Encrypt/Decrypt
     34 * `gpg --recipient user-id --encrypt doc`
     35 * `gpg --output doc --decrypt doc.gpg`
     36 
     37 or...
     38 
     39 * `gpg -c --s2k-cipher-algo AES256 --s2k-digest-algo SHA512 --s2k-count 65536 doc`
     40 * `gpg --output doc --decrypt doc.gpg`
     41 
     42 ## Signing
     43 * `gpg --output doc.sig --sign doc`
     44 * `gpg --output doc.sig --clearsign doc`
     45 * `gpg --output doc.sig --detach-sig doc`
     46 
     47 ## Verify
     48 * `gpg --verify example.sig`
     49 * `gpg --verify example.sig /path/to/example.iso`
     50 * `gpg --with-fingerprint <keyfile>`
     51 
     52 ## Send keys
     53 * `gpg --keyserver <keyserver> --send-keys <user-id>`
     54 * `gpg --recv-key '<fingerprint> && gpg --fingerprint '<fingerprint>'`
     55 * `gpg --search-keys '<userid>'`
     56 
     57 ## Sign key
     58 * `gpg --lsign-key '<fingerprint>'`
     59 
     60 or...
     61 
     62 * `gpg --sign-key '<fingerprint>'`