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

@@ -154,6 +154,13 @@ gpg --export-ssh-key 'ed25519_key' > ~'/.ssh/id_ed25519.pub'
# Integrate with Pinentry.
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
@@ -518,9 +525,7 @@ gpg-connect-agent reloadagent '/bye'
- [OpenPGP best practices]
- [GNU/Linux crypto series]
## Sources
All the references in the [further readings] section, plus the following:
### Sources
- [Decrypt multiple openpgp files in a directory]
- [ask redhat]
@@ -536,7 +541,8 @@ All the references in the [further readings] section, plus the following:
- [Stick with security: YubiKey, SSH, GnuPG, macOS]
<!--
References
Reference
═╬═Time══
-->
<!-- 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
[unattended key generation]: https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html
<!-- In-article sections -->
[further readings]: #further-readings
<!-- Others -->
[archlinux's gnupg wiki page]: https://wiki.archlinux.org/title/GnuPG
[ask redhat]: https://access.redhat.com/solutions/2115511

View File

@@ -34,3 +34,9 @@ gpgconf --launch gpg-agent
find . -type f -not -name '*.gpg' \
-path '*/values.*.y*ml' -path '*/secrets/*.*' \
-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'