Created
November 17, 2021 10:49
-
-
Save AuHau/802182c6c9b4b472d49dcc04a940e1fa to your computer and use it in GitHub Desktop.
GPG encryption for all primary's keys subkeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gpg-encrypt-me | |
if not set -q GPG_ME | |
echo "No your's GPG key set in GPG_ME variable!" | |
end | |
set recipients (gpg --list-keys --with-colons --fast-list-mode $GPG_ME | awk -F: '/^sub/{if ($12 == "e") {printf "-r 0x%s! ", $5}}') | |
gpg -r $recipients --armor --encrypt $argv | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have multiple encryption subkeys (like for example me, who has around 3 YubiKeys and for each dedicated Subkey set), then GPG does not by default encrypts for all of them. This is a simple fish function that encrypts for all your subkeys defined by the primary key specified in
GPG_ME
variable.