aboutsummaryrefslogtreecommitdiff
path: root/scripts/generate.sh
diff options
context:
space:
mode:
authorGravatar drduh <github@duh.to> 2025-05-10 16:31:51 -0700
committerGravatar drduh <github@duh.to> 2025-05-10 16:31:51 -0700
commitcbd39ffbb06e4e2ea3abed5b6e3d5fdee39818ab (patch)
treea061ab8e86b1605b74c1ccae55e20313b354c1f4 /scripts/generate.sh
parent1ab20d5fea38a45da42a29c5a0bb7b69912d9742 (diff)
downloadYubiKey-Guide-cbd39ffbb06e4e2ea3abed5b6e3d5fdee39818ab.tar.gz
YubiKey-Guide-cbd39ffbb06e4e2ea3abed5b6e3d5fdee39818ab.tar.zst
YubiKey-Guide-cbd39ffbb06e4e2ea3abed5b6e3d5fdee39818ab.zip
save mats functions
Diffstat (limited to '')
-rwxr-xr-xscripts/generate.sh39
1 files changed, 27 insertions, 12 deletions
diff --git a/scripts/generate.sh b/scripts/generate.sh
index e04000f..1d61bb5 100755
--- a/scripts/generate.sh
+++ b/scripts/generate.sh
@@ -65,23 +65,38 @@ gen_key_subs () {
gen_key_subs
-gpg -K
+list_keys () {
+ # Prints available secret keys.
+ gpg --list-secret-keys
+}
+
+save_secrets () {
+ # Exports secret keys to local files.
+ echo "$CERTIFY_PASS" | \
+ gpg --output $GNUPGHOME/$KEYID-Certify.key \
+ --batch --pinentry-mode=loopback --passphrase-fd 0 \
+ --armor --export-secret-keys $KEYID
+
+ echo "$CERTIFY_PASS" | \
+ gpg --output $GNUPGHOME/$KEYID-Subkeys.key \
+ --batch --pinentry-mode=loopback --passphrase-fd 0 \
+ --armor --export-secret-subkeys $KEYID
+}
-echo "$CERTIFY_PASS" | \
- gpg --output $GNUPGHOME/$KEYID-Certify.key \
- --batch --pinentry-mode=loopback --passphrase-fd 0 \
- --armor --export-secret-keys $KEYID
+save_pubkey () {
+ # Exports public key to local file.
+ gpg --output $GNUPGHOME/$KEYID-$(date +%F).asc \
+ --armor --export $KEYID
+}
-echo "$CERTIFY_PASS" | \
- gpg --output $GNUPGHOME/$KEYID-Subkeys.key \
- --batch --pinentry-mode=loopback --passphrase-fd 0 \
- --armor --export-secret-subkeys $KEYID
+list_keys
-gpg --output $GNUPGHOME/$KEYID-$(date +%F).asc \
- --armor --export $KEYID
+save_secrets
-export LUKS_PASS="$(get_pass)"
+save_pubkey
printf "CERTIFY PASS: \n$CERTIFY_PASS\n\n"
+export LUKS_PASS="$(get_pass)"
+
printf "LUKS PASS:\n$LUKS_PASS\n\n"