Progetto

Generale

Profilo

UsoDiOpenPGPCard » Cronologia » Versione 12

Elena Grandi, 19-10-2016 15:01

1 1 Elena Grandi
h1. Uso di OpenPGP Card
2
3 2 Elena Grandi
L'"OpenPGP Card":https://en.wikipedia.org/wiki/OpenPGP_card è una smartcard sulla quale si possono salvare in modo sicuro ed usare le sottochiavi segrete usate da GnuPG per crittografia, firma ed anche autenticazione; ne esistono versioni tradizionali, oppure implementate in un dispositivo USB. In ogni caso si possono caricare nuove chiavi sulla scheda, ma non si possono estrarre (per via software) quelle salvate ed è la scheda stessa ad effettuare le operazioni crittografiche.
4 1 Elena Grandi
5 2 Elena Grandi
L'obiettivo che si vuole ottenere è di non avere materiale crittografico segreto sui computer, in modo che un attaccante remoto non possa impossessarsene, mantenendo comunque la comodità di poter usare le chiavi sulla stessa macchina di uso comune. Per farlo si dovrà avere una chiave principale di lunga durata conservata offline ed usata solo saltuariamente per operazioni di gestione della chiave stessa (creazione di nuove sottochiavi, modifica delle scadenze, firma di altre chiavi per la _Web Of Trust_) e delle sottochiavi da usare quotidianamente, conservate sulla card.
6
7
Ll'OpenPGP Card permette di caricare tre sottochiavi con finalità di crittografia, firma ed autenticazione: le prime due si usano normalmente tramite GnuPG, la terza può essere usata per l'autenticazione ssh tramite gpg-agent.
8
9 3 Elena Grandi
h2. prerequisiti
10
11 2 Elena Grandi
Tutte le versioni di "GnuPG":https://gnupg.org/ supportano l'uso di base delle OpenPGP Card, ma per meglio sfruttarne le capacità è meglio usare la versione 2.1 (_modern_), specialmente in fase di creazione della chiave e delle sue sottochiavi.
12 1 Elena Grandi
13 3 Elena Grandi
Nel caso si voglia usare poi la Card per autenticazione ssh con versioni precedenti di GnuPG è necessario installare anche gpg-agent (in 2.1 usato di default).
14
15
Per il supporto della Card è poi necessario installare "PC/SC Lite":http://pcsclite.alioth.debian.org/.
16
17
Sotto distribuzioni debian o derivate (che già preinstallano @gnupg@ e @openssh-client@) i pacchetti da installare sono quindi:
18
19
<pre>
20
apt install pcscd gnupg-agent
21
</pre>
22 2 Elena Grandi
23
h2. creazione della chiave
24
25 4 Elena Grandi
Innanzitutto bisogna creare una chiave principale che verrà associata alla nostra identità; questa dovrà essere da almeno 4096 bit per garantirle sufficiente longevità, dato che la sua sostituzione comporta un nuovo ingresso nella Web of Trust.
26
27
Ovviamente, se si ha già una chiave gpg da 4096 bit si può saltare questo passaggio ed usare quella.
28
29
Innanzitutto, configurare gpg per l'uso di SHA2 aggiungendo le seguenti righe a @~/.gnupg/gpg.conf@:
30
31
<pre>
32
personal-digest-preferences SHA256
33
cert-digest-algo SHA256
34
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
35
</pre>
36
37
Quindi generare una nuova chiave: notare l'uso di gpg versione 2.1 e la dimensione a 4096 bit (per il resto si sono accettate le scelte di default oppure inseriti i propri dati).
38
39
<pre>
40
$ gpg --full-gen-key 
41
gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc.
42
This is free software: you are free to change and redistribute it.
43
There is NO WARRANTY, to the extent permitted by law.
44
45
Please select what kind of key you want:
46
   (1) RSA and RSA (default)
47
   (2) DSA and Elgamal
48
   (3) DSA (sign only)
49
   (4) RSA (sign only)
50
Your selection? 1
51
RSA keys may be between 1024 and 4096 bits long.
52
What keysize do you want? (2048) 4096
53
Requested keysize is 4096 bits
54
Please specify how long the key should be valid.
55
         0 = key does not expire
56
      <n>  = key expires in n days
57
      <n>w = key expires in n weeks
58
      <n>m = key expires in n months
59
      <n>y = key expires in n years
60
Key is valid for? (0) 
61
Key does not expire at all
62
Is this correct? (y/N) y
63
64
GnuPG needs to construct a user ID to identify your key.
65
66
Real name: Random User
67
Email address: random@example.org
68
Comment: 
69
You selected this USER-ID:
70
    "Random User <random@example.org>"
71
72
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
73
We need to generate a lot of random bytes. It is a good idea to perform
74
some other action (type on the keyboard, move the mouse, utilize the
75
disks) during the prime generation; this gives the random number
76
generator a better chance to gain enough entropy.
77
gpg: key 3E0EE5BAC50DF7C1 marked as ultimately trusted
78
gpg: directory '/home/random/.gnupg/openpgp-revocs.d' created
79
gpg: revocation certificate stored as '/home/valhalla/.gnupg/openpgp-revocs.d/19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1.rev'
80
public and secret key created and signed.
81
82
pub   rsa4096 2016-10-19 [SC]
83
      19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1
84
      19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1
85
uid                      Random User <random@example.org>
86
sub   rsa4096 2016-10-19 [E]
87
</pre>
88
89 2 Elena Grandi
h2. creazione delle sottochiavi
90
91 5 Elena Grandi
Questo è il punto in cui è particolarmente importante l'uso di GnuPG 2.1, che rende molto più semplice la creazione di una chiave per l'autenticazione.
92
93
Molte delle OpenPGP Card disponibili sul mercato supportano chiavi al massimo a 2048 bit: questo non è un grosso problema dato che al momento sono considerate ancora ragionevolmente sicure, ed una loro eventuale sostituzione in futuro non è particolarmente onerosa (oltre ovviamente alla necessità di usare una Card o un dispositivo diverso).
94
95
Per generare le sottochiavi necessarie, si entra in modalità di modifica con l'opzione @--expert@ che abilita la creazione di chiavi di autenticazione.
96
97
<pre>
98
$ gpg --expert --edit-key 3E0EE5BAC50DF7C1
99
gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc.
100
This is free software: you are free to change and redistribute it.
101
There is NO WARRANTY, to the extent permitted by law.
102
103
Secret key is available.
104
105
sec  rsa4096/3E0EE5BAC50DF7C1
106
     created: 2016-10-19  expires: never       usage: SC  
107
     trust: ultimate      validity: ultimate
108
ssb  rsa4096/F303978FEBB6E995
109
     created: 2016-10-19  expires: never       usage: E   
110
[ultimate] (1). Random User <random@example.org>
111
</pre>
112
113
Quindi si crea prima una normale sottochiave di firma (opzione 4)
114
115
<pre>
116
gpg> addkey 
117
Please select what kind of key you want:
118
   (3) DSA (sign only)
119
   (4) RSA (sign only)
120
   (5) Elgamal (encrypt only)
121
   (6) RSA (encrypt only)
122
   (7) DSA (set your own capabilities)
123
   (8) RSA (set your own capabilities)
124
  (10) ECC (sign only)
125
  (11) ECC (set your own capabilities)
126
  (12) ECC (encrypt only)
127
  (13) Existing key
128
Your selection? 4
129
RSA keys may be between 1024 and 4096 bits long.
130
What keysize do you want? (2048) 
131
Requested keysize is 2048 bits
132
Please specify how long the key should be valid.
133
         0 = key does not expire
134
      <n>  = key expires in n days
135
      <n>w = key expires in n weeks
136
      <n>m = key expires in n months
137
      <n>y = key expires in n years
138
Key is valid for? (0) 1y
139
Key expires at Thu 19 Oct 2017 12:15:49 CEST
140
Is this correct? (y/N) y
141
Really create? (y/N) y
142
We need to generate a lot of random bytes. It is a good idea to perform
143
some other action (type on the keyboard, move the mouse, utilize the
144
disks) during the prime generation; this gives the random number
145
generator a better chance to gain enough entropy.
146
147
sec  rsa4096/3E0EE5BAC50DF7C1
148
     created: 2016-10-19  expires: never       usage: SC  
149
     trust: ultimate      validity: ultimate
150
ssb  rsa4096/F303978FEBB6E995
151
     created: 2016-10-19  expires: never       usage: E   
152
ssb  rsa2048/40A2ADF0FE9E4620
153
     created: 2016-10-19  expires: 2017-10-19  usage: S   
154
[ultimate] (1). Random User <random@example.org>
155
156
</pre>
157
158
Una normale sottochiave per la crittografia (opzione 6)
159
160
<pre>
161
gpg> addkey 
162
Please select what kind of key you want:
163
   (3) DSA (sign only)
164
   (4) RSA (sign only)
165
   (5) Elgamal (encrypt only)
166
   (6) RSA (encrypt only)
167
   (7) DSA (set your own capabilities)
168
   (8) RSA (set your own capabilities)
169
  (10) ECC (sign only)
170
  (11) ECC (set your own capabilities)
171
  (12) ECC (encrypt only)
172
  (13) Existing key
173
Your selection? 6
174
RSA keys may be between 1024 and 4096 bits long.
175
What keysize do you want? (2048) 
176
Requested keysize is 2048 bits
177
Please specify how long the key should be valid.
178
         0 = key does not expire
179
      <n>  = key expires in n days
180
      <n>w = key expires in n weeks
181
      <n>m = key expires in n months
182
      <n>y = key expires in n years
183
Key is valid for? (0) 1y
184
Key expires at Thu 19 Oct 2017 12:18:16 CEST
185
Is this correct? (y/N) y
186
Really create? (y/N) y
187
We need to generate a lot of random bytes. It is a good idea to perform
188
some other action (type on the keyboard, move the mouse, utilize the
189
disks) during the prime generation; this gives the random number
190
generator a better chance to gain enough entropy.
191
192
sec  rsa4096/3E0EE5BAC50DF7C1
193
     created: 2016-10-19  expires: never       usage: SC  
194
     trust: ultimate      validity: ultimate
195
ssb  rsa4096/F303978FEBB6E995
196
     created: 2016-10-19  expires: never       usage: E   
197
ssb  rsa2048/40A2ADF0FE9E4620
198
     created: 2016-10-19  expires: 2017-10-19  usage: S   
199
ssb  rsa2048/ED9BBD7B3BFF900F
200
     created: 2016-10-19  expires: 2017-10-19  usage: E   
201
[ultimate] (1). Random User <random@example.org>
202
</pre>
203
204
Ed infine una sottochiave per l'autenticazione, selezionando l'opzione 8, togliendo le capacità di firma e crittografia e mettendo quella di autenticazione.
205
206
<pre>
207
gpg> addkey 
208
Please select what kind of key you want:
209
   (3) DSA (sign only)
210
   (4) RSA (sign only)
211
   (5) Elgamal (encrypt only)
212
   (6) RSA (encrypt only)
213
   (7) DSA (set your own capabilities)
214
   (8) RSA (set your own capabilities)
215
  (10) ECC (sign only)
216
  (11) ECC (set your own capabilities)
217
  (12) ECC (encrypt only)
218
  (13) Existing key
219
Your selection? 8
220
221
Possible actions for a RSA key: Sign Encrypt Authenticate 
222
Current allowed actions: Sign Encrypt 
223
224
   (S) Toggle the sign capability
225
   (E) Toggle the encrypt capability
226
   (A) Toggle the authenticate capability
227
   (Q) Finished
228
229
Your selection? s
230
231
Possible actions for a RSA key: Sign Encrypt Authenticate 
232
Current allowed actions: Encrypt 
233
234
   (S) Toggle the sign capability
235
   (E) Toggle the encrypt capability
236
   (A) Toggle the authenticate capability
237
   (Q) Finished
238
239
Your selection? e
240
241
Possible actions for a RSA key: Sign Encrypt Authenticate 
242
Current allowed actions: 
243
244
   (S) Toggle the sign capability
245
   (E) Toggle the encrypt capability
246
   (A) Toggle the authenticate capability
247
   (Q) Finished
248
249
Your selection? a
250
251
Possible actions for a RSA key: Sign Encrypt Authenticate 
252
Current allowed actions: Authenticate 
253
254
   (S) Toggle the sign capability
255
   (E) Toggle the encrypt capability
256
   (A) Toggle the authenticate capability
257
   (Q) Finished
258
259
Your selection? q
260
RSA keys may be between 1024 and 4096 bits long.
261
What keysize do you want? (2048) 
262
Requested keysize is 2048 bits
263
Please specify how long the key should be valid.
264
         0 = key does not expire
265
      <n>  = key expires in n days
266
      <n>w = key expires in n weeks
267
      <n>m = key expires in n months
268
      <n>y = key expires in n years
269
Key is valid for? (0) 1y
270
Key expires at Thu 19 Oct 2017 12:24:56 CEST
271
Is this correct? (y/N) y
272
Really create? (y/N) y
273
We need to generate a lot of random bytes. It is a good idea to perform
274
some other action (type on the keyboard, move the mouse, utilize the
275
disks) during the prime generation; this gives the random number
276
generator a better chance to gain enough entropy.
277
278
sec  rsa4096/3E0EE5BAC50DF7C1
279
     created: 2016-10-19  expires: never       usage: SC  
280
     trust: ultimate      validity: ultimate
281
ssb  rsa4096/F303978FEBB6E995
282
     created: 2016-10-19  expires: never       usage: E   
283
ssb  rsa2048/40A2ADF0FE9E4620
284
     created: 2016-10-19  expires: 2017-10-19  usage: S   
285
ssb  rsa2048/ED9BBD7B3BFF900F
286
     created: 2016-10-19  expires: 2017-10-19  usage: E   
287
ssb  rsa2048/5F89B668295AE797
288
     created: 2016-10-19  expires: 2017-10-19  usage: A   
289
[ultimate] (1). Random User <random@example.org>
290
</pre>
291
292
Si può quindi uscire dalla modalità di modifica chiave, salvando le modifiche.
293
294
<pre>
295
gpg> save
296
</pre>
297
298 7 Elena Grandi
h2. salvataggio su supporto esterno
299
300 8 Elena Grandi
A questo punto la chiave è ancora gestita nel modo tradizionale, su hard disk. Questo è il momento di salvarne un backup e di farne una copia su chiavetta USB da usare in futuro per le modifiche della chiave.
301
302 9 Elena Grandi
Per il backup ci sono vari metodi, da una semplice e poco efficiente copia di tutta la @~/.gnupg@ su un ulteriore supporto all'uso di "paperkey":http://www.jabberwocky.com/software/paperkey/ per salvare una copia su carta; l'importante è che venga fatto e custodito in un luogo sicuro, anche se magari remoto (cassetta di sicurezza).
303 8 Elena Grandi
304 9 Elena Grandi
Per avere una copia della chiave principale da usare sporadicamente, invece, è necessario copiare l'intera @~/.gnupg@ su una chiavetta USB o simili; una volta fatta la copia verificare che contenga quanto dovuto con 
305
306
<pre>
307
$ gpg --homedir indirizzo/della/chiavetta/gnupg --list-secret-keys
308
indirizzo/della/chiavetta/gnupg
309
pubring.gpg
310
---------------------------------
311
sec   rsa4096 2016-10-19 [SC]
312
      19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1
313
uid           [ultimate] Random User <random@example.org>
314
ssb   rsa4096 2016-10-19 [E]
315
ssb   rsa2048 2016-10-19 [S] [expires: 2017-10-19]
316
ssb   rsa2048 2016-10-19 [E] [expires: 2017-10-19]
317
ssb   rsa2048 2016-10-19 [A] [expires: 2017-10-19]
318
</pre>
319
320
smontare la chiavetta e riporla in un luogo sicuro; la si userà nuovamente quando sarà necessario cambiare le date di scadenza delle sottochiavi, oppure firmare chiavi di altre persone, per la Web of Trust.
321 8 Elena Grandi
322 2 Elena Grandi
h2. spostamento delle chiavi sulla Card
323
324 10 Elena Grandi
Per il prossimo passaggio è estremamente importante assicurarsi di aver fatto le copie delle chiavi e sottochiavi private: in questo passaggio verranno trasferite sulla Card, dalla quale non possono più essere estratte, e cancellate dal disco.
325
326
Collegare il lettore al computer, inserire la Card e controllare che venga correttamente riconosciuta:
327
328
<pre>
329
$ gpg --card-status 
330
Reader ...........: ####
331
Application ID ...: ####
332
Version ..........: 2.0
333
Manufacturer .....: ####
334
Serial number ....: ####
335
Name of cardholder: [not set]
336
Language prefs ...: [not set]
337
Sex ..............: unspecified
338
URL of public key : [not set]
339
Login data .......: [not set]
340
Signature PIN ....: forced
341
Key attributes ...: rsa2048 rsa2048 rsa2048
342
Max. PIN lengths .: 127 127 127
343
PIN retry counter : 3 3 3
344
Signature counter : 0
345
Signature key ....: [none]
346
Encryption key....: [none]
347
Authentication key: [none]
348
General key info..: [none]
349
</pre>
350
351 12 Elena Grandi
Cambiare poi i pin della chiave:
352
353
<pre>
354
$ gpg --card-edit
355
Reader ...........: ####
356
Application ID ...: ####
357
Version ..........: 2.0
358
Manufacturer .....: ####
359
Serial number ....: ####
360
Name of cardholder: [not set]
361
Language prefs ...: [not set]
362
Sex ..............: unspecified
363
URL of public key : [not set]
364
Login data .......: [not set]
365
Signature PIN ....: forced
366
Key attributes ...: rsa2048 rsa2048 rsa2048
367
Max. PIN lengths .: 127 127 127
368
PIN retry counter : 3 3 3
369
Signature counter : 0
370
Signature key ....: [none]
371
Encryption key....: [none]
372
Authentication key: [none]
373
General key info..: [none]
374
375
gpg/card> admin
376
Admin commands are allowed
377
378
gpg/card> passwd
379
gpg: OpenPGP card no. #### detected
380
381
1 - change PIN
382
2 - unblock PIN
383
3 - change Admin PIN
384
4 - set the Reset Code
385
Q - quit
386
387
Your selection? 
388
389
[TODO: completare il cambiamento pin dopo aver sbloccato la Card di prova]
390
391
</pre>
392
393 10 Elena Grandi
Si può quindi passare a spostare le varie sottochiavi sulla Card, aprendo la modalità di editing della chiave:
394
395
<pre>
396
$ gpg --edit-key 3E0EE5BAC50DF7C1
397
gpg (GnuPG) 2.1.15; Copyright (C) 2016 Free Software Foundation, Inc.
398
This is free software: you are free to change and redistribute it.
399
There is NO WARRANTY, to the extent permitted by law.
400
401
Secret key is available.
402
403
sec  rsa4096/3E0EE5BAC50DF7C1
404
     created: 2016-10-19  expires: never       usage: SC  
405
     trust: ultimate      validity: ultimate
406
ssb  rsa4096/F303978FEBB6E995
407
     created: 2016-10-19  expires: never       usage: E   
408
ssb  rsa2048/40A2ADF0FE9E4620
409
     created: 2016-10-19  expires: 2017-10-19  usage: S   
410
ssb  rsa2048/ED9BBD7B3BFF900F
411
     created: 2016-10-19  expires: 2017-10-19  usage: E   
412
ssb  rsa2048/5F89B668295AE797
413
     created: 2016-10-19  expires: 2017-10-19  usage: A   
414
[ultimate] (1). Random User <random@example.org>
415
</pre>
416
417
passando alla modalità di modifica delle chiavi private
418
419
<pre>
420
gpg> toggle
421
422
sec  rsa4096/3E0EE5BAC50DF7C1
423
     created: 2016-10-19  expires: never       usage: SC  
424
     trust: ultimate      validity: ultimate
425
ssb  rsa4096/F303978FEBB6E995
426
     created: 2016-10-19  expires: never       usage: E   
427
ssb  rsa2048/40A2ADF0FE9E4620
428
     created: 2016-10-19  expires: 2017-10-19  usage: S   
429
ssb  rsa2048/ED9BBD7B3BFF900F
430
     created: 2016-10-19  expires: 2017-10-19  usage: E   
431
ssb  rsa2048/5F89B668295AE797
432
     created: 2016-10-19  expires: 2017-10-19  usage: A   
433
[ultimate] (1). Random User <random@example.org>
434
</pre>
435
436
e trasferendo una ad una le sottochiavi sulla Card; firma:
437
438
<pre>
439
gpg> key 2
440
441
sec  rsa4096/3E0EE5BAC50DF7C1
442
     created: 2016-10-19  expires: never       usage: SC  
443
     trust: ultimate      validity: ultimate
444
ssb  rsa4096/F303978FEBB6E995
445
     created: 2016-10-19  expires: never       usage: E   
446
ssb* rsa2048/40A2ADF0FE9E4620
447
     created: 2016-10-19  expires: 2017-10-19  usage: S   
448
ssb  rsa2048/ED9BBD7B3BFF900F
449
     created: 2016-10-19  expires: 2017-10-19  usage: E   
450
ssb  rsa2048/5F89B668295AE797
451
     created: 2016-10-19  expires: 2017-10-19  usage: A   
452
[ultimate] (1). Random User <random@example.org>
453
454
gpg> keytocard
455
Please select where to store the key:
456
   (1) Signature key
457
   (3) Authentication key
458
Your selection? 1
459
gpg: KEYTOCARD failed: Bad PIN
460
461
gpg> keytocard
462
Please select where to store the key:
463
   (1) Signature key
464
   (3) Authentication key
465
Your selection? 1
466
467
sec  rsa4096/3E0EE5BAC50DF7C1
468
     created: 2016-10-19  expires: never       usage: SC  
469
     trust: ultimate      validity: ultimate
470
ssb  rsa4096/F303978FEBB6E995
471
     created: 2016-10-19  expires: never       usage: E   
472
ssb* rsa2048/40A2ADF0FE9E4620
473
     created: 2016-10-19  expires: 2017-10-19  usage: S   
474
ssb  rsa2048/ED9BBD7B3BFF900F
475
     created: 2016-10-19  expires: 2017-10-19  usage: E   
476
ssb  rsa2048/5F89B668295AE797
477
     created: 2016-10-19  expires: 2017-10-19  usage: A   
478
[ultimate] (1). Random User <random@example.org>
479
</pre>
480
481
crittografia:
482
483
<pre>
484
gpg> key 2
485
486
sec  rsa4096/3E0EE5BAC50DF7C1
487
     created: 2016-10-19  expires: never       usage: SC  
488
     trust: ultimate      validity: ultimate
489
ssb  rsa4096/F303978FEBB6E995
490
     created: 2016-10-19  expires: never       usage: E   
491
ssb  rsa2048/40A2ADF0FE9E4620
492
     created: 2016-10-19  expires: 2017-10-19  usage: S   
493
ssb  rsa2048/ED9BBD7B3BFF900F
494
     created: 2016-10-19  expires: 2017-10-19  usage: E   
495
ssb  rsa2048/5F89B668295AE797
496
     created: 2016-10-19  expires: 2017-10-19  usage: A   
497
[ultimate] (1). Random User <random@example.org>
498
499
gpg> key 3
500
501
sec  rsa4096/3E0EE5BAC50DF7C1
502
     created: 2016-10-19  expires: never       usage: SC  
503
     trust: ultimate      validity: ultimate
504
ssb  rsa4096/F303978FEBB6E995
505
     created: 2016-10-19  expires: never       usage: E   
506
ssb  rsa2048/40A2ADF0FE9E4620
507
     created: 2016-10-19  expires: 2017-10-19  usage: S   
508
ssb* rsa2048/ED9BBD7B3BFF900F
509
     created: 2016-10-19  expires: 2017-10-19  usage: E   
510
ssb  rsa2048/5F89B668295AE797
511
     created: 2016-10-19  expires: 2017-10-19  usage: A   
512
[ultimate] (1). Random User <random@example.org>
513
514
gpg> keytocard
515
Please select where to store the key:
516
   (2) Encryption key
517
Your selection? 2
518
519
sec  rsa4096/3E0EE5BAC50DF7C1
520
     created: 2016-10-19  expires: never       usage: SC  
521
     trust: ultimate      validity: ultimate
522
ssb  rsa4096/F303978FEBB6E995
523
     created: 2016-10-19  expires: never       usage: E   
524
ssb  rsa2048/40A2ADF0FE9E4620
525
     created: 2016-10-19  expires: 2017-10-19  usage: S   
526
ssb* rsa2048/ED9BBD7B3BFF900F
527
     created: 2016-10-19  expires: 2017-10-19  usage: E   
528
ssb  rsa2048/5F89B668295AE797
529
     created: 2016-10-19  expires: 2017-10-19  usage: A   
530
[ultimate] (1). Random User <random@example.org>
531
</pre>
532
533
autenticazione:
534
535
<pre>
536
gpg> key 3
537
538
sec  rsa4096/3E0EE5BAC50DF7C1
539
     created: 2016-10-19  expires: never       usage: SC  
540
     trust: ultimate      validity: ultimate
541
ssb  rsa4096/F303978FEBB6E995
542
     created: 2016-10-19  expires: never       usage: E   
543
ssb  rsa2048/40A2ADF0FE9E4620
544
     created: 2016-10-19  expires: 2017-10-19  usage: S   
545
ssb  rsa2048/ED9BBD7B3BFF900F
546
     created: 2016-10-19  expires: 2017-10-19  usage: E   
547
ssb  rsa2048/5F89B668295AE797
548
     created: 2016-10-19  expires: 2017-10-19  usage: A   
549
[ultimate] (1). Random User <random@example.org>
550
551
gpg> key 4
552
553
sec  rsa4096/3E0EE5BAC50DF7C1
554
     created: 2016-10-19  expires: never       usage: SC  
555
     trust: ultimate      validity: ultimate
556
ssb  rsa4096/F303978FEBB6E995
557
     created: 2016-10-19  expires: never       usage: E   
558
ssb  rsa2048/40A2ADF0FE9E4620
559
     created: 2016-10-19  expires: 2017-10-19  usage: S   
560
ssb  rsa2048/ED9BBD7B3BFF900F
561
     created: 2016-10-19  expires: 2017-10-19  usage: E   
562
ssb* rsa2048/5F89B668295AE797
563
     created: 2016-10-19  expires: 2017-10-19  usage: A   
564
[ultimate] (1). Random User <random@example.org>
565
566
gpg> keytocard
567
Please select where to store the key:
568
   (3) Authentication key
569
Your selection? 3
570
571
sec  rsa4096/3E0EE5BAC50DF7C1
572
     created: 2016-10-19  expires: never       usage: SC  
573
     trust: ultimate      validity: ultimate
574
ssb  rsa4096/F303978FEBB6E995
575
     created: 2016-10-19  expires: never       usage: E   
576
ssb  rsa2048/40A2ADF0FE9E4620
577
     created: 2016-10-19  expires: 2017-10-19  usage: S   
578
ssb  rsa2048/ED9BBD7B3BFF900F
579
     created: 2016-10-19  expires: 2017-10-19  usage: E   
580
ssb* rsa2048/5F89B668295AE797
581
     created: 2016-10-19  expires: 2017-10-19  usage: A   
582
[ultimate] (1). Random User <random@example.org>
583
</pre>
584
585 11 Elena Grandi
Uscire salvando:
586
587
<pre>
588
gpg> save
589
</pre>
590
591
e a questo punto si può controllare che le sottochiavi sono sulla Card:
592
593
<pre>
594
$ gpg --card-status 
595
596
Reader ...........: ####
597
Application ID ...: ####
598
Version ..........: 2.0
599
Manufacturer .....: ####
600
Serial number ....: ####
601
Name of cardholder: [not set]
602
Language prefs ...: [not set]
603
Sex ..............: unspecified
604
URL of public key : [not set]
605
Login data .......: [not set]
606
Signature PIN ....: forced
607
Key attributes ...: rsa2048 rsa2048 rsa2048
608
Max. PIN lengths .: 127 127 127
609
PIN retry counter : 3 3 3
610
Signature counter : 0
611
Signature key ....: 2128 412C BC75 34F5 6305  9447 40A2 ADF0 FE9E 4620
612
      created ....: 2016-10-19 10:15:26
613
Encryption key....: 0B24 9C62 4A7D 19FE 7AB9  DCB3 ED9B BD7B 3BFF 900F
614
      created ....: 2016-10-19 10:17:57
615
Authentication key: 40E1 AE4A 7C13 FD8C C6EA  2C56 5F89 B668 295A E797
616
      created ....: 2016-10-19 10:24:14
617
General key info..: sub  rsa2048/40A2ADF0FE9E4620 2016-10-19 Random User <random@example.org>
618
sec   rsa4096/3E0EE5BAC50DF7C1  created: 2016-10-19  expires: never     
619
ssb   rsa4096/F303978FEBB6E995  created: 2016-10-19  expires: never     
620
ssb>  rsa2048/40A2ADF0FE9E4620  created: 2016-10-19  expires: 2017-10-19
621
                                card-no: ####
622
ssb>  rsa2048/ED9BBD7B3BFF900F  created: 2016-10-19  expires: 2017-10-19
623
                                card-no: ####
624
ssb>  rsa2048/5F89B668295AE797  created: 2016-10-19  expires: 2017-10-19
625
                                card-no: ####
626
</pre>
627
628
e non sono più presenti sul disco
629
630
<pre>
631
$ gpg --list-secret-keys 
632
/home/random/.gnupg/pubring.gpg
633
---------------------------------
634
sec   rsa4096 2016-10-19 [SC]
635
      19DB75A75734ABBEDB1124163E0EE5BAC50DF7C1
636
uid           [ultimate] Random User <random@example.org>
637
ssb   rsa4096 2016-10-19 [E]
638
ssb>  rsa2048 2016-10-19 [S] [expires: 2017-10-19]
639
ssb>  rsa2048 2016-10-19 [E] [expires: 2017-10-19]
640
ssb>  rsa2048 2016-10-19 [A] [expires: 2017-10-19]
641
</pre>
642
643
è però ancora presente la chiave principale.
644 10 Elena Grandi
645 2 Elena Grandi
h2. configurazione di ssh
646 6 Elena Grandi
647
h2. configurazione su una nuova macchina
648
649
h2. configurazione su una nuova macchina, con versioni precedenti di gpg