chore(gnupg): just get the ascii value of keys with no headers nor footers

This commit is contained in:
Michele Cereda
2025-05-01 13:02:42 +02:00
parent d82ce08f6a
commit 5fcba8c686
2 changed files with 17 additions and 8 deletions

View File

@@ -20,7 +20,7 @@
1. [`sign_and_send_pubkey: signing failed for … from agent: agent refused operation`](#sign_and_send_pubkey-signing-failed-for--from-agent-agent-refused-operation) 1. [`sign_and_send_pubkey: signing failed for … from agent: agent refused operation`](#sign_and_send_pubkey-signing-failed-for--from-agent-agent-refused-operation)
1. [New configuration settings are ineffective](#new-configuration-settings-are-ineffective) 1. [New configuration settings are ineffective](#new-configuration-settings-are-ineffective)
1. [Further readings](#further-readings) 1. [Further readings](#further-readings)
1. [Sources](#sources) 1. [Sources](#sources)
## TL;DR ## TL;DR
@@ -154,6 +154,13 @@ gpg --export-ssh-key 'ed25519_key' > ~'/.ssh/id_ed25519.pub'
# Integrate with Pinentry. # Integrate with Pinentry.
export GPG_TTY="$(tty)" export GPG_TTY="$(tty)"
# Only get the base64 armored string in the key
# -e '/^-----/d' removes the header and footer
# -e '/^=/d' removes the base64 checksum at the bottom
# -e '/^$/d' removes empty lines
gpg --armor --export 'someone@example.org' | sed -e '/^-----/d' -e '/^=/d' -e '/^$/d'
``` ```
## Encryption ## Encryption
@@ -518,9 +525,7 @@ gpg-connect-agent reloadagent '/bye'
- [OpenPGP best practices] - [OpenPGP best practices]
- [GNU/Linux crypto series] - [GNU/Linux crypto series]
## Sources ### Sources
All the references in the [further readings] section, plus the following:
- [Decrypt multiple openpgp files in a directory] - [Decrypt multiple openpgp files in a directory]
- [ask redhat] - [ask redhat]
@@ -536,7 +541,8 @@ All the references in the [further readings] section, plus the following:
- [Stick with security: YubiKey, SSH, GnuPG, macOS] - [Stick with security: YubiKey, SSH, GnuPG, macOS]
<!-- <!--
References Reference
═╬═Time══
--> -->
<!-- Upstream --> <!-- Upstream -->
@@ -544,9 +550,6 @@ All the references in the [further readings] section, plus the following:
[modify .gnupg home directories]: https://www.gnupg.org/documentation/manuals/gnupg/gpgconf.html [modify .gnupg home directories]: https://www.gnupg.org/documentation/manuals/gnupg/gpgconf.html
[unattended key generation]: https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html [unattended key generation]: https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
<!-- In-article sections -->
[further readings]: #further-readings
<!-- Others --> <!-- Others -->
[archlinux's gnupg wiki page]: https://wiki.archlinux.org/title/GnuPG [archlinux's gnupg wiki page]: https://wiki.archlinux.org/title/GnuPG
[ask redhat]: https://access.redhat.com/solutions/2115511 [ask redhat]: https://access.redhat.com/solutions/2115511

View File

@@ -34,3 +34,9 @@ gpgconf --launch gpg-agent
find . -type f -not -name '*.gpg' \ find . -type f -not -name '*.gpg' \
-path '*/values.*.y*ml' -path '*/secrets/*.*' \ -path '*/values.*.y*ml' -path '*/secrets/*.*' \
-exec gpg --batch --encrypt-files --yes -r "0123...CDEF" "{}" ';' -exec gpg --batch --encrypt-files --yes -r "0123...CDEF" "{}" ';'
# Only get the base64 armored string in the key
# -e '/^-----/d' removes the header and footer
# -e '/^=/d' removes the base64 checksum at the bottom
# -e '/^$/d' removes empty lines
gpg --armor --export 'someone@example.org' | sed -e '/^-----/d' -e '/^=/d' -e '/^$/d'