aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar drduh <github@duh.to> 2025-05-10 17:59:19 -0700
committerGravatar drduh <github@duh.to> 2025-05-10 17:59:19 -0700
commit7473d2e0d885493dc175beae4bdc69f995cde6fe (patch)
treee8e0c48f466fe4c3bfa2a11bfb63fc8370029bdf
parent04dbdf35c3ecc14ca27ecc6abf3ff9c2c1dfbfe4 (diff)
downloadYubiKey-Guide-7473d2e0d885493dc175beae4bdc69f995cde6fe.tar.gz
YubiKey-Guide-7473d2e0d885493dc175beae4bdc69f995cde6fe.tar.zst
YubiKey-Guide-7473d2e0d885493dc175beae4bdc69f995cde6fe.zip
reuse key list for id/fp
-rwxr-xr-xscripts/generate.sh18
1 files changed, 8 insertions, 10 deletions
diff --git a/scripts/generate.sh b/scripts/generate.sh
index f889e96..faf857f 100755
--- a/scripts/generate.sh
+++ b/scripts/generate.sh
@@ -28,7 +28,7 @@ get_id_label () {
get_key_type () {
# Returns key type and size.
- printf "rsa2048"
+ printf "rsa4096"
}
get_key_expiration () {
@@ -82,14 +82,12 @@ gen_key_certify () {
"$KEY_TYPE" "cert" "never"
}
-set_id_fp () {
+set_fingerprint () {
# Sets Key ID and Fingerprint environment vars.
- export KEY_ID=$(gpg -k --with-colons "$IDENTITY" | \
- awk -F: '/^pub:/ { print $5; exit }')
- export KEY_FP=$(gpg -k --with-colons "$IDENTITY" | \
- awk -F: '/^fpr:/ { print $10; exit }')
- printf "got identity (fp='%s', id='%s')\n" \
- "$KEY_FP" "$KEY_ID"
+ key_list=$(gpg --list-secret-keys --with-colons)
+ export KEY_ID=$(printf "$key_list" | awk -F: '/^sec/ { print $5; exit }')
+ export KEY_FP=$(printf "$key_list" | awk -F: '/^fpr/ { print $10; exit }')
+ printf "got identity (fp='%s', id='%s')\n" "$KEY_FP" "$KEY_ID"
}
gen_key_subs () {
@@ -134,7 +132,7 @@ finish () {
printf "subkeys expiration: "
print_id "$KEY_EXPIRATION"
- printf "\nsecrets and pubkey: "
+ printf "\nsecrets and pubkey: "
print_id "$GNUPGHOME"
print_id "$OUTPUT_PUBKEY"
@@ -159,7 +157,7 @@ set_pass
gen_key_certify
# 5. Set resulting identity fingerprint.
-set_id_fp
+set_fingerprint
# 6. Generate the Subkeys.
gen_key_subs