GNU Privacy Guard (auch GnuPG oder GPG genannt) ist FOSS und implementiert den OpenPGP- und in Version 2 auch den S/MIME- und den PGP/MIME-Standard. Es wurde als Ersatz für das proprietäre Pretty Good Privacy (PGP) entwickelt.
funktioniert immer (hässliches popup fenster auf windows)
keyid-format long pinentry-mode ask
windows (kein popup):
keyid-format long pinentry-mode loopback
default-cache-ttl 3600 default-cache-ttl-ssh 3600 max-cache-ttl 28800 max-cache-ttl-ssh 28800 allow-loopback-pinentry
Unter Windows: Umgebungsvariable anlegen
GNUPGHOME=%userprofile%\.gnupg
evtl. Dateien vom alten ins neue dir verschieben (powershell commands)
> mv $env:userprofile/AppData/Roaming/gnupg/* $env:userprofile/.gnupg/ > rm -r $env:userprofile/AppData/Roaming/gnupg/
gpg agent restart bzw. start/stop (z.B. bei dem error: gpg: can't connect to the agent: Invalid value passed to IPC)
> gpg-connect-agent /bye > gpg-connect-agent killagent /bye
das /bye verhindert, dass man in dem prompt von gpg-connect-agent bleibt
> echo "test" | gpg --clearsign
Wichtig! Wenn das Signieren mit GPG nicht geht, liegt es womöglich daran, dass GPG die TTY nicht findet und deshalb nicht nach der Passphrase fragen kann
> echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
GPG (CLI-Version) auf FreeBSD 14.0 installieren:
> pkg install security/gpg-tui
eine GPG-Schlüsselpaar (privaten + öffentlichen Schlüssel) erzeugen:
> gpg --full-generate-key
gpg (GnuPG) 2.4.3; Copyright (C) 2023 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: directory '/home/quarzsnoopy/.gnupg' created
Please select what kind of key you want:
(1) RSA and RSA
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
(9) ECC (sign and encrypt) *default*
(10) ECC (sign only)
(14) Existing key from card
Your selection?
Please select which elliptic curve you want:
(1) Curve 25519 *default*
(4) NIST P-384
(6) Brainpool P-256
Your selection?
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
RSA and RSA und 4096 auswählen> gpg --edit-key XXXXXXXXXXXXXXXX
Wichtig: Wie oben gezeigt, das Format in der gpg.conf setzen, oder --keyid-format long angeben, sonst erhält man nur die verkürzte Ausgabe!
> gpg -k
> gpg -K
Wichtig: Man sollte beim normalen Export die Dateiendung .gpg wählen und beim Export mit -a / --armor (ASCII armored) die Dateiendung .asc wählen
Wenn man keine Key für --export / --export-secret-keys spezifiziert, werden alle exportiert!
> gpg -a -o gpg-public-keys.asc --export XXXXXXXXXXXXXXXX
> gpg -a -o gpg-private-keys.asc --export-secret-keys XXXXXXXXXXXXXXXX
empfohlen statt trustdb.gpg zu sichern
> gpg --export-ownertrust > gpg-ownertrust.txt
> gpg --import gpg-public-keys.asc > gpg --import gpg-private-keys.asc
> gpg --import-ownertrust gpg-ownertrust.txt
> gpg -a --export XXXXXXXXXXXXXXXX | ssh other-machine gpg --import
> ssh other-machine gpg -a --export XXXXXXXXXXXXXXXX | gpg --import
nach import erforderlich, wenn man ownertrust nicht übernommen hat
> gpg --edit-key XXXXXXXXXXXXXXXX gpg> trust gpg> save