Skip to content

Commit 8c4d80d

Browse files
authored
Merge pull request #485 from drduh/wip-13apr25
collapse more uids details, prefer explicit expirations
2 parents 5bce454 + f22d1c7 commit 8c4d80d

File tree

1 file changed

+30
-35
lines changed

1 file changed

+30
-35
lines changed

README.md

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ To suggest an improvement, send a pull request or open an [issue](https://github
1414
* [Expiration](#expiration)
1515
* [Passphrase](#passphrase)
1616
- [Create Certify key](#create-certify-key)
17-
- [Add additional uids (optional)](#add-additional-uids-optional)
1817
- [Create Subkeys](#create-subkeys)
1918
- [Verify keys](#verify-keys)
2019
- [Backup keys](#backup-keys)
@@ -368,16 +367,16 @@ When Subkeys expire, they may still be used to decrypt with GnuPG and authentica
368367

369368
Subkeys must be renewed or rotated using the Certify key - see [Updating keys](#updating-keys).
370369

371-
Set the expiration date to two years:
370+
Set the Subkeys expiration to a specific date:
372371

373372
```console
374-
export EXPIRATION=2y
373+
export EXPIRATION=2027-05-01
375374
```
376375

377-
Or set the expiration date to a specific date to schedule maintenance:
376+
The expiration date may also be relative, for example set to two years:
378377

379378
```console
380-
export EXPIRATION=2026-05-01
379+
export EXPIRATION=2y
381380
```
382381

383382
## Passphrase
@@ -431,11 +430,10 @@ export KEYFP=$(gpg -k --with-colons "$IDENTITY" | awk -F: '/^fpr:/ { print $10;
431430
printf "\nKey ID: %40s\nKey FP: %40s\n\n" "$KEYID" "$KEYFP"
432431
```
433432

434-
# Add additional uids (optional)
435-
436-
## Rationale
433+
<details>
434+
<summary>Add additional IDs (optional)</summary>
437435

438-
This is an optional step if you have a use case which requires [additional identities](https://github.com/drduh/YubiKey-Guide/issues/445). Some non-exhaustive example use cases are:
436+
This is an optional step for use cases requiring [additional identities](https://github.com/drduh/YubiKey-Guide/issues/445), for example:
439437

440438
- different email addresses for different languages
441439
- different email addresses for professional versus personal but please see alternative reason below for not tying these addresses together
@@ -446,24 +444,22 @@ An alternative would be to have distinct keys but you would then require multipl
446444
- if you have different email addresses for professional versus personal use cases, having distinct keys allow you to disassociate the identities
447445
- if you are also using the YubiKey as a U2F or FIDO2 device, having multiple YubiKeys is generally recommended as a backup measure
448446

449-
## Steps
450-
451-
Define an array containing additional uids. As this is bash syntax, each array element should be surrounded by quotes and each element should be separated by a space:
447+
Define an array containing additional user IDs. Each array element must be wrapped in quotes and each element must be space-delimited:
452448

453449
```console
454450
declare -a additional_uids
455451
additional_uids=("Super Cool YubiKey 2025" "uid 1 <[email protected]>")
456452
```
457453

458-
Add the additional uids to the key:
454+
Add the additional user IDs to the Certify key:
459455

460456
```console
461457
for uid in "${additional_uids[@]}" ; do \
462458
echo "$CERTIFY_PASS" | gpg --batch --passphrase-fd 0 --pinentry-mode=loopback --quick-add-uid "$KEYFP" "$uid"
463459
done
464460
```
465461

466-
Adjust the trust of the additional uids to be ultimate:
462+
Adjust the trust of the additional IDs to *ultimate*:
467463

468464
```console
469465
gpg --command-fd=0 --pinentry-mode=loopback --edit-key "$KEYID" <<EOF
@@ -474,10 +470,11 @@ y
474470
save
475471
EOF
476472
```
473+
</details>
477474

478475
# Create Subkeys
479476

480-
Use the following command to generate Signature, Encryption and Authentication Subkeys using the previously configured key type, passphrase and expiration:
477+
Generate Signature, Encryption and Authentication Subkeys using the previously configured key type, passphrase and expiration:
481478

482479
```console
483480
for SUBKEY in sign encrypt auth ; do \
@@ -497,12 +494,12 @@ gpg -K
497494
The output will display **[C]ertify, [S]ignature, [E]ncryption and [A]uthentication** keys:
498495

499496
```console
500-
sec rsa4096/0xF0F2CFEB04341FB5 2024-01-01 [C]
497+
sec rsa4096/0xF0F2CFEB04341FB5 2025-01-01 [C]
501498
Key fingerprint = 4E2C 1FA3 372C BA96 A06A C34A F0F2 CFEB 0434 1FB5
502499
uid [ultimate] YubiKey User <yubikey@example>
503-
ssb rsa4096/0xB3CD10E502E19637 2024-01-01 [S] [expires: 2026-05-01]
504-
ssb rsa4096/0x30CBE8C4B085B9F7 2024-01-01 [E] [expires: 2026-05-01]
505-
ssb rsa4096/0xAD9E24E1B8CB9600 2024-01-01 [A] [expires: 2026-05-01]
500+
ssb rsa4096/0xB3CD10E502E19637 2025-01-01 [S] [expires: 2027-05-01]
501+
ssb rsa4096/0x30CBE8C4B085B9F7 2025-01-01 [E] [expires: 2027-05-01]
502+
ssb rsa4096/0xAD9E24E1B8CB9600 2025-01-01 [A] [expires: 2027-05-01]
506503
```
507504

508505
# Backup keys
@@ -926,12 +923,12 @@ EOF
926923
Verify Subkeys have been moved to YubiKey with `gpg -K` and look for `ssb>`, for example:
927924

928925
```console
929-
sec rsa4096/0xF0F2CFEB04341FB5 2024-01-01 [C]
926+
sec rsa4096/0xF0F2CFEB04341FB5 2025-01-01 [C]
930927
Key fingerprint = 4E2C 1FA3 372C BA96 A06A C34A F0F2 CFEB 0434 1FB5
931928
uid [ultimate] YubiKey User <yubikey@example>
932-
ssb> rsa4096/0xB3CD10E502E19637 2024-01-01 [S] [expires: 2026-05-01]
933-
ssb> rsa4096/0x30CBE8C4B085B9F7 2024-01-01 [E] [expires: 2026-05-01]
934-
ssb> rsa4096/0xAD9E24E1B8CB9600 2024-01-01 [A] [expires: 2026-05-01]
929+
ssb> rsa4096/0xB3CD10E502E19637 2025-01-01 [S] [expires: 2027-05-01]
930+
ssb> rsa4096/0x30CBE8C4B085B9F7 2025-01-01 [E] [expires: 2027-05-01]
931+
ssb> rsa4096/0xAD9E24E1B8CB9600 2025-01-01 [A] [expires: 2027-05-01]
935932
```
936933

937934
The `>` after a tag indicates the key is stored on a smart card.
@@ -1094,18 +1091,18 @@ PIN retry counter : 3 3 3
10941091
Signature counter : 0
10951092
KDF setting ......: on
10961093
Signature key ....: CF5A 305B 808B 7A0F 230D A064 B3CD 10E5 02E1 9637
1097-
created ....: 2024-01-01 12:00:00
1094+
created ....: 2025-01-01 12:00:00
10981095
Encryption key....: A5FA A005 5BED 4DC9 889D 38BC 30CB E8C4 B085 B9F7
1099-
created ....: 2024-01-01 12:00:00
1096+
created ....: 2025-01-01 12:00:00
11001097
Authentication key: 570E 1355 6D01 4C04 8B6D E2A3 AD9E 24E1 B8CB 9600
1101-
created ....: 2024-01-01 12:00:00
1102-
General key info..: sub rsa4096/0xB3CD10E502E19637 2024-01-01 YubiKey User <yubikey@example>
1103-
sec# rsa4096/0xF0F2CFEB04341FB5 created: 2024-01-01 expires: never
1104-
ssb> rsa4096/0xB3CD10E502E19637 created: 2024-01-01 expires: 2026-05-01
1098+
created ....: 2025-01-01 12:00:00
1099+
General key info..: sub rsa4096/0xB3CD10E502E19637 2025-01-01 YubiKey User <yubikey@example>
1100+
sec# rsa4096/0xF0F2CFEB04341FB5 created: 2025-01-01 expires: never
1101+
ssb> rsa4096/0xB3CD10E502E19637 created: 2025-01-01 expires: 2027-05-01
11051102
card-no: 0006 05553211
1106-
ssb> rsa4096/0x30CBE8C4B085B9F7 created: 2024-01-01 expires: 2026-05-01
1103+
ssb> rsa4096/0x30CBE8C4B085B9F7 created: 2025-01-01 expires: 2027-05-01
11071104
card-no: 0006 05553211
1108-
ssb> rsa4096/0xAD9E24E1B8CB9600 created: 2024-01-01 expires: 2026-05-01
1105+
ssb> rsa4096/0xAD9E24E1B8CB9600 created: 2025-01-01 expires: 2027-05-01
11091106
card-no: 0006 05553211
11101107
```
11111108

@@ -1186,7 +1183,7 @@ gpg --verify signed.txt
11861183
The output will be similar to:
11871184

11881185
```console
1189-
gpg: Signature made Mon 01 Jan 2024 12:00:00 PM UTC
1186+
gpg: Signature made Mon 01 Jan 2025 12:00:00 PM UTC
11901187
gpg: using RSA key CF5A305B808B7A0F230DA064B3CD10E502E19637
11911188
gpg: Good signature from "YubiKey User <yubikey@example>" [ultimate]
11921189
Primary key fingerprint: 4E2C 1FA3 372C BA96 A06A C34A F0F2 CFEB 0434 1FB5
@@ -1932,9 +1929,7 @@ export CERTIFY_PASS=ABCD-0123-IJKL-4567-QRST-UVWX
19321929
Determine the updated expiration, for example:
19331930
19341931
```console
1935-
export EXPIRATION=2026-09-01
1936-
1937-
export EXPIRATION=2y
1932+
export EXPIRATION=2027-09-01
19381933
```
19391934
19401935
Renew the Subkeys:

0 commit comments

Comments
 (0)