linux-gpg

JSON

rev 30  |  foxhop  |  1405158978000  |  JSON

rev 29
rev 30
142If you want to encrypt a directory instead of a file, use the gpg-zip tool:142If you want to encrypt a directory instead of a file, use the gpg-zip tool:
143143
n144.. code-block: bashn144.. code-block:: bash
145145
146 gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip146 gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip
148If you want to use a single shared key use the --symmetric flag.  It will prompt148If you want to use a single shared key use the --symmetric flag.  It will prompt
> you for a password twice:> you for a password twice:
149149
n150.. code-block: bashn150.. code-block:: bash
151151
152 gpg-zip --symmetric ~/.password-store > password-store.gpg-zip152 gpg-zip --symmetric ~/.password-store > password-store.gpg-zip
tt153 
154 
155--list-archive:
156  List the contents of the specified archive.
157 
153158
154Homework159Homework
rev 29  |  foxhop  |  1405157137000  |  JSON

rev 28
rev 29
137137
138138
t139encrypt a directoryt139Encrypt a directory
140===================140===================
141141
rev 28  |  foxhop  |  1405157120000  |  JSON

rev 27
rev 28
137137
138138
tt139encrypt a directory
140===================
141 
142If you want to encrypt a directory instead of a file, use the gpg-zip tool:
143 
144.. code-block: bash
145 
146 gpg-zip ~/home/user/secret-files > ~/home/user/secret-files.gpg-zip
147 
148If you want to use a single shared key use the --symmetric flag.  It will prompt
 > you for a password twice:
149 
150.. code-block: bash
151 
152 gpg-zip --symmetric ~/.password-store > password-store.gpg-zip
153 
139Homework154Homework
140============155============
rev 27  |  foxhop  |  1404081069000  |  JSON

rev 26
rev 27
134 5134 5
135 y135 y
tt136 quit
136137
137138
rev 26  |  foxhop  |  1404081033000  |  JSON

rev 25
rev 26
123 gpg --delete-secret-key <KeyID>123 gpg --delete-secret-key <KeyID>
124124
nn125Edit and Trust a key
126====================
127 
128To edit a keys trust level (for instance to completely trust your own key) do th
 >e following:
129 
130.. code-block:: bash
131 
132 gpg --edit-key <KeyID>
133 trust
134 5
135 y
136 
137 
125Homework138Homework
126============139============
139* The keyring files are binary and exist in *~/.gnupg*.152* The keyring files are binary and exist in *~/.gnupg*.
140153
t141 t
rev 25  |  foxhop  |  1404075609000  |  JSON

rev 24
rev 25
123 gpg --delete-secret-key <KeyID>123 gpg --delete-secret-key <KeyID>
124124
n125 n
126Homework125Homework
127============126============
134#. re-import public and private key pair133#. re-import public and private key pair
135#. try to decrypt test file again134#. try to decrypt test file again
tt135 
136Misc
137====
138 
139* The keyring files are binary and exist in *~/.gnupg*.
140 
141 
rev 24  |  foxhop  |  1403527595000  |  JSON

rev 23
rev 24
88
99
t10Create Key pairt10Create a key pair
11==================11==================
1212
rev 23  |  foxhop  |  1403527565000  |  JSON

rev 22
rev 23
127============127============
128128
n129#. create a gpg keypairn129#. create a gpg key pair
130#. encrypt a test file130#. encrypt a test file
131#. decrypt a test file131#. decrypt a test file
t132#. export public and private keypairt132#. export public and private key pair
133#. delete public and private keypair133#. delete public and private key pair
134#. re-import public and private keypair134#. re-import public and private key pair
135#. try to decrypt test file again135#. try to decrypt test file again
rev 22  |  foxhop  |  1403527546000  |  JSON

rev 21
rev 22
88
99
t10Create GPG Keypairt10Create Key pair
11==================11==================
1212
rev 21  |  foxhop  |  1403527511000  |  JSON

rev 20
rev 21
2###########2###########
33
t4Short how to document on setting up a PGP (GPG) keypair and a short lesson on hot4This document shows how to use the command line to work with PGP (GPG) for encry
>w to encrypt a message as well as configuring "pass" password client for using t>ption.
>he keypair to protect passwords. 
5 
6This document does not use a GUI and only uses the command line.
75
8.. contents::6.. contents::
rev 20  |  foxhop  |  1403526854000  |  JSON

rev 19
rev 20
125 gpg --delete-secret-key <KeyID>125 gpg --delete-secret-key <KeyID>
126126
tt127 
128Homework
129============
130 
131#. create a gpg keypair
132#. encrypt a test file
133#. decrypt a test file
134#. export public and private keypair
135#. delete public and private keypair
136#. re-import public and private keypair
137#. try to decrypt test file again
rev 19  |  foxhop  |  1403526643000  |  JSON

rev 18
rev 19
68Then paste the encrypted message into the terminal.68Then paste the encrypted message into the terminal.
6969
t70or optionally omit the 'encrypted message file' and paste the payload directly it70Optionally omit the 'encrypted message file' and paste the payload directly into
>nto the cmd prompt. > the cmd prompt. 
7171
72Export a public key72Export a public key
rev 18  |  foxhop  |  1403526626000  |  JSON

rev 17
rev 18
95========================95========================
9696
t97To import a public key file:t
98 
99.. code-block:: bash97.. code-block:: bash
10098
rev 17  |  foxhop  |  1403526604000  |  JSON

rev 16
rev 17
104104
105105
n106Import a public keyn106Import a private key
107========================107========================
108108
109.. code-block:: bash109.. code-block:: bash
110110
t111 gpg --allow-secret-key-import --import <public key file>t111 gpg --allow-secret-key-import --import <private key file>
112112
113This adds the private key in the file to your private key ring. Alternatively yo113This adds the private key in the file to your private key ring. Alternatively yo
>u may omit the file and paste the private key directly to the command prompt.>u may omit the file and paste the private key directly to the command prompt.
rev 16  |  foxhop  |  1403526502000  |  JSON

rev 15
rev 16
75To export a public key for transportation or sharing, run this:75To export a public key for transportation or sharing, run this:
7676
n77.. code-block:: n77.. code-block:: bash
7878
79 gpg --export -a <KeyID>79 gpg --export -a <KeyID>
86To export a private key for transportation or backup, run this:86To export a private key for transportation or backup, run this:
8787
n88.. code-block:: n88.. code-block:: bash
8989
90 gpg --export-secret-key -a <KeyID>90 gpg --export-secret-key -a <KeyID>
97To import a public key file:97To import a public key file:
9898
t99.. code-block::t99.. code-block:: bash
100100
101 gpg --import <public key file>101 gpg --import <public key file>
rev 15  |  foxhop  |  1403526303000  |  JSON

rev 14
rev 15
107========================107========================
108108
n109.. code-block::n109.. code-block:: bash
110110
111 gpg --allow-secret-key-import --import <public key file>111 gpg --allow-secret-key-import --import <public key file>
112112
113This adds the private key in the file to your private key ring. Alternatively yo113This adds the private key in the file to your private key ring. Alternatively yo
>u may omit the file and paste the private key directly to the command prompt.>u may omit the file and paste the private key directly to the command prompt.
tt114 
115Delete a public key
116=====================
117 
118.. code-block:: bash
119 
120 gpg --delete-key <KeyID>
121 
122Delete a private key
123=====================
124 
125.. code-block:: bash
126 
127 gpg --delete-secret-key <KeyID>
128 
rev 14  |  foxhop  |  1403526165000  |  JSON

rev 13
rev 14
6969
70or optionally omit the 'encrypted message file' and paste the payload directly i70or optionally omit the 'encrypted message file' and paste the payload directly i
>nto the cmd prompt. >nto the cmd prompt. 
tt71 
72Export a public key
73========================
74 
75To export a public key for transportation or sharing, run this:
76 
77.. code-block:: 
78 
79 gpg --export -a <KeyID>
80 
81This will output the public key for a given KeyID as ascii, which may be shared 
 >and distributed to anyone.
82 
83Export a private key
84========================
85 
86To export a private key for transportation or backup, run this:
87 
88.. code-block:: 
89 
90 gpg --export-secret-key -a <KeyID>
91 
92This will output the private key for a given KeyID as ascii, which must be safel
 >y gaurded.
93 
94Import a public key
95========================
96 
97To import a public key file:
98 
99.. code-block::
100 
101 gpg --import <public key file>
102 
103This adds the public key in the file to your public key ring.  Alternatively you
 > may omit the file and paste the public key directly to the command prompt.
104 
105 
106Import a public key
107========================
108 
109.. code-block::
110 
111 gpg --allow-secret-key-import --import <public key file>
112 
113This adds the private key in the file to your private key ring. Alternatively yo
 >u may omit the file and paste the private key directly to the command prompt.
rev 13  |  foxhop  |  1403525363000  |  JSON

rev 12
rev 13
64.. code-block:: bash64.. code-block:: bash
6565
t66 gpg -d <encrypted message file>t66 gpg -d <encrypted asc message file>
6767
68Then paste the encrypted message into the terminal.68Then paste the encrypted message into the terminal.
rev 12  |  foxhop  |  1403525321000  |  JSON

rev 11
rev 12
44It will prompt for a passphrase three times unless a valid one is submitted, the44It will prompt for a passphrase three times unless a valid one is submitted, the
>n it will allow you to write an encrypted message.  press ctrl-d to end the mess>n it will allow you to write an encrypted message.  press ctrl-d to end the mess
>age.>age.
4545
tt46Alternatively you may encrypt any file (text or binary) using a command like thi
 >s:
47 
48.. code-block:: bash
49 
50 gpg --local-user <KEYID> -as <file>
51 
52This will prompt for your passphrase and on success generate an 'asc' file.
53 
54For example, lets encrypt the fake test file 'secret-raw-payload.txt' using the 
 >following command:
55 
56.. code-block:: bash
57 
58 gpg --local-user MYKEYID1 -as secret-raw-payload.txt
59 
60 
46Decrypt a test message61Decrypt a test message
47==============================62==============================
rev 11  |  foxhop  |  1403524710000  |  JSON

rev 10
rev 11
55
6This document does not use a GUI and only uses the command line.6This document does not use a GUI and only uses the command line.
tt7 
8.. contents::
9 
10 
711
8Create GPG Keypair12Create GPG Keypair
rev 10  |  foxhop  |  1403524687000  |  JSON

rev 9
rev 10
40It will prompt for a passphrase three times unless a valid one is submitted, the40It will prompt for a passphrase three times unless a valid one is submitted, the
>n it will allow you to write an encrypted message.  press ctrl-d to end the mess>n it will allow you to write an encrypted message.  press ctrl-d to end the mess
>age.>age.
4141
t42decrypt the test messaget42Decrypt a test message
43==============================43==============================
4444
rev 9  |  foxhop  |  1403524580000  |  JSON

rev 8
rev 9
4Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho4Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho
>w to encrypt a message as well as configuring "pass" password client for using t>w to encrypt a message as well as configuring "pass" password client for using t
>he keypair to protect passwords.>he keypair to protect passwords.
55
t6Creating GPG Keys Using the Command Linet6This document does not use a GUI and only uses the command line.
7==========================================7 
8Create GPG Keypair
9==================
810
9Use the following shell command:11Use the following shell command:
rev 8  |  foxhop  |  1403524413000  |  JSON

rev 7
rev 8
27 gpg --list-keys27 gpg --list-keys
2828
n29Validate a GPG passphrase and encrypt a test messagen29Encrypt a test message
30=========================================================30=========================================================
tt31 
32This process may also be used to Validate a private key passphrase.
3133
32.. code-block:: bash34.. code-block:: bash
rev 7  |  foxhop  |  1403524357000  |  JSON

rev 6
rev 7
16Also memorize your long passphrase and never tell anyone it, ever.16Also memorize your long passphrase and never tell anyone it, ever.
1717
n18Document your new <keyid>n18Document your new 'KeyID'.
1919
t20Determine KeyIDt20List all keys
21===================21=============================
22 
23This is a great way to determine a 'KeyID'
2224
23.. code-block:: bash25.. code-block:: bash
rev 6  |  foxhop  |  1403524234000  |  JSON

rev 5
rev 6
39.. code-block:: bash39.. code-block:: bash
4040
n41 gpg -dn41 gpg -d <encrypted message file>
4242
43Then paste the encrypted message into the terminal.43Then paste the encrypted message into the terminal.
tt44 
45or optionally omit the 'encrypted message file' and paste the payload directly i
 >nto the cmd prompt. 
rev 5  |  foxhop  |  1403478006000  |  JSON

rev 4
rev 5
34It will prompt for a passphrase three times unless a valid one is submitted, the34It will prompt for a passphrase three times unless a valid one is submitted, the
>n it will allow you to write an encrypted message.  press ctrl-d to end the mess>n it will allow you to write an encrypted message.  press ctrl-d to end the mess
>age.>age.
3535
tt36decrypt the test message
37==============================
38 
39.. code-block:: bash
40 
41 gpg -d
42 
43Then paste the encrypted message into the terminal.
rev 4  |  foxhop  |  1403477377000  |  JSON

rev 3
rev 4
16Also memorize your long passphrase and never tell anyone it, ever.16Also memorize your long passphrase and never tell anyone it, ever.
1717
t18 t18Document your new <keyid>
19 
20Determine KeyID
21===================
22 
23.. code-block:: bash
24 
25 gpg --list-keys
26 
27Validate a GPG passphrase and encrypt a test message
28=========================================================
29 
30.. code-block:: bash
31 
32 gpg --local-user <KEYID> -as
33 
34It will prompt for a passphrase three times unless a valid one is submitted, the
 >n it will allow you to write an encrypted message.  press ctrl-d to end the mess
 >age.
35 
rev 3  |  foxhop  |  1403474560000  |  JSON

rev 2
rev 3
1414
15Answer the prompts, I typically accept all defaults which is 2048 bits and RSA.15Answer the prompts, I typically accept all defaults which is 2048 bits and RSA.
tt16Also memorize your long passphrase and never tell anyone it, ever.
1617
17 18 
rev 2  |  foxhop  |  1403473569000  |  JSON

rev 1
rev 2
9Use the following shell command:9Use the following shell command:
1010
t11.. code-block::t11.. code-block:: bash
1212
13 gpg --gen-key13 gpg --gen-key
rev 1  |  foxhop  |  1403473541000  |  JSON

empty
rev 1
tt1Linux GPG
2###########
3 
4Short how to document on setting up a PGP (GPG) keypair and a short lesson on ho
 >w to encrypt a message as well as configuring "pass" password client for using t
 >he keypair to protect passwords.
5 
6Creating GPG Keys Using the Command Line
7==========================================
8 
9Use the following shell command:
10 
11.. code-block::
12 
13 gpg --gen-key
14 
15Answer the prompts, I typically accept all defaults which is 2048 bits and RSA.
16 
17