GPG - Übung

test1@work:~$ gpg --list-secret-keys
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
/home/test1/.gnupg/pubring.kbx
------------------------------
sec   rsa3072 2024-09-16 [SC] [verf"allt: 2026-09-16]
      B8D5A098DE17C6FA58146E1C4526404956B2D517
uid        [ ultimativ ] david Vajda
ssb   rsa3072 2024-09-16 [E] [verf"allt: 2026-09-16]

test1@work:~$ gpg --list-keys
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
/home/test1/.gnupg/pubring.kbx
------------------------------
pub   rsa3072 2024-09-16 [SC] [verf"allt: 2026-09-16]
      B8D5A098DE17C6FA58146E1C4526404956B2D517
uid        [ ultimativ ] david Vajda
sub   rsa3072 2024-09-16 [E] [verf"allt: 2026-09-16]

test1@work:~$ gpg --full-gen-key
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
gpg (GnuPG) 2.2.40; Copyright (C) 2022 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.

Bitte w"ahlen Sie, welche Art von Schl"ussel Sie m"ochten:
   (1) RSA und RSA (voreingestellt)
   (2) DSA und Elgamal
   (3) DSA (nur signieren/beglaubigen)
   (4) RSA (nur signieren/beglaubigen)
   (14) Vorhandener Schl"ussel auf der Karte
Ihre Auswahl? 1
RSA-Schl"ussel k"onnen zwischen 1024 und 4096 Bit lang sein.
Welche Schl"ussell"ange w"unschen Sie? (3072)
Die verlangte Schl"ussell"ange betr"agt 3072 Bit
Bitte w"ahlen Sie, wie lange der Schl"ussel g"ultig bleiben soll.
         0 = Schl"ussel verf"allt nie
      <n>  = Schl"ussel verf"allt nach n Tagen
      <n>w = Schl"ussel verf"allt nach n Wochen
      <n>m = Schl"ussel verf"allt nach n Monaten
      <n>y = Schl"ussel verf"allt nach n Jahren
Wie lange bleibt der Schl"ussel g"ultig? (0)
Schl"ussel verf"allt nie
Ist dies richtig? (j/N) j

GnuPG erstellt eine User-ID, um Ihren Schl"ussel identifizierbar zu machen.

Ihr Name ("Vorname Nachname"): David Vajda
Email-Adresse: david@ituenix.de
Kommentar:
Sie haben diese User-ID gew"ahlt:
    "David Vajda <david@ituenix.de>"

"Andern: (N)ame, (K)ommentar, (E)-Mail oder (F)ertig/(A)bbrechen? F
Wir m"ussen eine ganze Menge Zufallswerte erzeugen.  Sie k"onnen dies
unterst"utzen, indem Sie z.B. in einem anderen Fenster/Konsole irgendetwas
tippen, die Maus verwenden oder irgendwelche anderen Programme benutzen.
Wir m"ussen eine ganze Menge Zufallswerte erzeugen.  Sie k"onnen dies
unterst"utzen, indem Sie z.B. in einem anderen Fenster/Konsole irgendetwas
tippen, die Maus verwenden oder irgendwelche anderen Programme benutzen.
gpg: Widerrufzertifikat wurde als '/home/test1/.gnupg/openpgp-revocs.d/1572223D8E74D9BD4646849B253EEF1786033D77.rev' gespeichert.
"Offentlichen und geheimen Schl"ussel erzeugt und signiert.

pub   rsa3072 2024-09-16 [SC]
      1572223D8E74D9BD4646849B253EEF1786033D77
uid                      David Vajda <david@ituenix.de>
sub   rsa3072 2024-09-16 [E]

test1@work:~$ gpg -a --export 1572223D8E74D9BD4646849B253EEF1786033D77
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGNBGboQJ4BDADRFgNboZDU/kE44ZJM6fchEDKt0s1KLSYImO4RYbEKb4IGhg13
+HFvBb8yANbAcuGRfRgvmFjAwMWkCZmEiIba2OlJZKZjOjGX8ktaF13t6FE+Yjpf
10w8NUdEy58EleB1Gz3/8wdxZumyTs3G6080Wr8d6IBRCoWz9DLxzT/YTXiJg8Pv
uxhFj6D4eQVJrlMmZIJAVuXoXiXOdFJAUCq2iCYLAv2Jr5u2Rq+G2WO2CWzlzUrB
U7KjZHXzhIwnhweK4FpM9Yo2U9AmXswA5WvRDCnHyI/47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+WiHBC2mUg/jVbeXU3uBEPn41fi3L9HqJ+gVJGJ/z
qs5kmGJKdW1pxQiIX76ssxk81k7SZMpL3LTRPROHJRoXRZxB2QZ57tlMuSqcwS5Y
3X2SKRadb3EftdYAWMM0SlokviReU+PCuEIl7bAD7IoFLwGLu3P2d0ywEguJKZuK
Pq7/wmKSJaGAytPw8wNdSo4x9mSUH6E9GCpt/C0KVpMdfnHGCjws+R6P30tgncJm
iJWfYd1EL+OAYYpaS3xNM5tfQYUF2PfhyovH0We/SysM7w/mZQVfSVYZIgEOEv1D
/uy0wIdW4loIYiYhUdugZSrrsT+8f6IOdsf5Tzcq3PMnQJwVev4jV2sY/UsAEQEA
AYkBtgQYAQoAIBYhBBVyIj2OdNm9RkaEmyU+7xeGAz13BQJm6ECeAhsMAAoJECU+
7xeGAz13F38L/AtDKf64iHsAruU10O+kE8U86gWUYiQjqj43qauO18ozQSPcDKrg
jLOTxFYP4luZa+zTC0syOBUHzS65sRjT2/Mgm4z98W00pcNvdDuZ7IstxAKDlkCr
F4L9Tn59L+uY3OooOO4W7GMkh6+LLvqGJZ29meuVME1yMI/kJhyJGiM3H1U9kP78
/PFfVb9m6fyriBxQDB7DgsbUieVEn3yFTSL5OFL6Br+a+158y0+WRV7dxdSMCEL6
fxL92GxXDd0pZeKuzUta1Y3IomZRfnej/q40fhZUiTgEOmOtqiiOKkBg/hU76KQ6
hXel5efwa+e5Be+OLNHMD5u59Q6SJYcwVv0PLjI79Z6cJh8R225T2pzGPHaD4U4I
YGJcMy/9jsRF60/3gD7DqJmYjPftwZgs5/0q5dF/+DfJR9mKjXjX0oIJubHMhn5m
2VB6vp+vW1zSh+hsrxwoV6DWvnjChsyue14KQQ8G5gm2sVgybXbl0gre7swqVAsF
5aAfTMDQzhFvDg==
=M5c3
-----END PGP PUBLIC KEY BLOCK-----
test1@work:~$ gpg -a --output gpg-key --export 1572223D8E74D9BD4646849B253EEF1786033D77
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
test1@work:~$ ls
Bilder     Downloads  Musik       Schreibtisch  Vorlagen
Dokumente  gpg-key    "Offentlich  Videos
test1@work:~$ cat gpg-key
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQGNBGboQJ4BDADRFgNboZDU/kE44ZJM6fchEDKt0s1KLSYImO4RYbEKb4IGhg13
+HFvBb8yANbAcuGRfRgvmFjAwMWkCZmEiIba2OlJZKZjOjGX8ktaF13t6FE+Yjpf
10w8NUdEy58EleB1Gz3/8wdxZumyTs3G6080Wr8d6IBRCoWz9DLxzT/YTXiJg8Pv
uxhFj6D4eQVJrlMmZIJAVuXoXiXOdFJAUCq2iCYLAv2Jr5u2Rq+G2WO2CWzlzUrB
U7KjZHXzhIwnhweK4FpM9Yo2U9AmXswA5WvRDCnHyI/47ElCAePHTEJ+Qt1muQ7m
WdPOr30acQuRxWc4D3+9vnV+riU1W91s3MzjSA7WaQLggKWj3hW/YBPHUpRifljZ
eP4OXgzD9g9gCSsYxF42m9XnVpEwAr4V1IuVOWduM0c78QYJhkxbya1MsaeTDqHG
S7dYz6xm7k0xcpepy5yKweadbOUUrLuYfzqcZ6DcEYNFDpyHHRdvtI5UphPy9AHg
WtonbU0ANivdAQkAEQEAAbQeRGF2aWQgVmFqZGEgPGRhdmlkQGl0dWVuaXguZGU+
iQHOBBMBCgA4FiEEFXIiPY502b1GRoSbJT7vF4YDPXcFAmboQJ4CGwMFCwkIBwIG
FQoJCAsCBBYCAwECHgECF4AACgkQJT7vF4YDPXdncQv+K4BdH8hM/nWCjyuczEMg
4RuAIPcBfLQEEhWR1dZww/05/Oypml5dth2oNizqw0C3B3GOiwVTY/uybVJuu33n
ph5YXWj7Y+XPB8hzs9s3Y7EWs8AGc53rHAtNoev2B1uofbkoXPO87YRDPDlE1f5o
SH3kmiLv2+Npy8OIHBnA7CnWQUDxHouq+AOxZxTdo8LvOvRUrXNSXWcWZRTquPke
u7Ur2HoLtGd7Y88djMRTx9mYHekcYFvcIldXm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xQDB7DgsbUieVEn3yFTSL5OFL6Br+a+158y0+WRV7dxdSMCEL6
fxL92GxXDd0pZeKuzUta1Y3IomZRfnej/q40fhZUiTgEOmOtqiiOKkBg/hU76KQ6
hXel5efwa+e5Be+OLNHMD5u59Q6SJYcwVv0PLjI79Z6cJh8R225T2pzGPHaD4U4I
YGJcMy/9jsRF60/3gD7DqJmYjPftwZgs5/0q5dF/+DfJR9mKjXjX0oIJubHMhn5m
2VB6vp+vW1zSh+hsrxwoV6DWvnjChsyue14KQQ8G5gm2sVgybXbl0gre7swqVAsF
5aAfTMDQzhFvDg==
=M5c3
-----END PGP PUBLIC KEY BLOCK-----
test1@work:~$ nano
test1@work:~$ gpg --encrypt -a --recipient 1572223D8E74D9BD4646849B253EEF1786033D77 klartext.txt
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
gpg: "Trust-DB" wird "uberpr"uft
gpg: marginals needed: 3  completes needed: 1  trust model: pgp
gpg: Tiefe: 0  g"ultig:   2  signiert:   0  Vertrauen: 0-, 0q, 0n, 0m, 0f, 2u
gpg: n"achste "Trust-DB"-Pflicht"uberpr"ufung am 2026-09-16
test1@work:~$ ls
Bilder     Downloads  klartext.txt      Musik       Schreibtisch  Vorlagen
Dokumente  gpg-key    klartext.txt.asc  "Offentlich  Videos
test1@work:~$ cat klartext.txt.asc
-----BEGIN PGP MESSAGE-----

hQGMAzwH/oYwzKzpAQwAkVyEDK+XjfotHGd7xRWlIui69ZmrWIsjwjSfTeEylM8C
TFKvYeIp/ksw65bVbD9PVgZX++mAqkpPlFaY88qks1NFXbuf0ZsR3H/VfzvvzuAi
ZO0oFslfqp7k0DhQ/TrVz89XCq7x2qXOEUBFtXw8X6KverWWxCqj0SRg9u+LAWS3
9hYQENvPKLgm5pdRI7/g5NJBih8K4SpcS4euu54lGEUSjTa0gZ3+p96tqQ3bqPUu
ByI0p/NUqPJ7if66FQI9idDVBhbaXuluiPY9woGvFC9Qsu/2UuGiDfmp/XE9IWcK
BMycG8TFN+V/xTdnLhTJCIr/d6VZNtyxuO9gyoCknJoBceQMl4qFSAIXftolyQ3t
4IoRZmLwD5wy8PzYcPix/4CtWpgRtPXiawXZTa4JlKAdsUp+rmmueuvp/YP6TP8B
JLIDiV6vbhQO2zbPhqz6Kv8PBWGwSnX8xSWbWZQF8cVPTiMS7pFUUyztXKm25R79
suWjVkiow0+E3YwaduqV0lMBInDgzMrqItOZvEdnl8rFrSG5t8bK4pMQxz8Yjza1
xkV91EQDA9Itp5Boh2J8RuHi4+8VSc5kw/ZbsVpbizRq15H6u9h2w+F3hiuCgCAR
yv133A==
=Z8Ar
-----END PGP MESSAGE-----
test1@work:~$ gpg --decrypt --output entschluesselt.txt
bash01.txt        .config/          gpg-key           "Offentlich/
.bash_history     Dokumente/        klartext.txt      .profile
.bash_logout      Downloads/        klartext.txt.asc  Schreibtisch/
.bashrc           .face             .local/           .ssh/
Bilder/           .face.icon        .mozilla/         Videos/
.cache/           .gnupg/           Musik/            Vorlagen/
test1@work:~$ gpg --decrypt --output entschluesselt.txt klartext.txt.asc
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
gpg: verschl"usselt mit 3072-Bit RSA Schl"ussel, ID 3C07FE8630CCACE9, erzeugt 2024-09-16
      "David Vajda <david@ituenix.de>"
test1@work:~$ cat entschluesselt.txt
Dies ist klartext
test1@work:~$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/test1/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/test1/.ssh/id_rsa
Your public key has been saved in /home/test1/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:TR945nyYtt2UoJ4wQ//B4IXN5MHesB8pswyl9SxNFt4 test1@work
The key's randomart image is:
+---[RSA 4096]----+
|            .o ..|
|           .*=oo.|
|         .ooO*X.E|
|        .ooO=X.B.|
|        S+.+XoB.o|
|          =.o*.+ |
|           o... .|
|                 |
|                 |
+----[SHA256]-----+
test1@work:~$ ssh-copy-id -i .ssh/id_rsa.pub test2@work
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host 'work (127.0.1.1)' can't be established.
ED25519 key fingerprint is SHA256:lDSmxfFV1ZAhBshE3UPQC15YWKRq6g6kAanqIwvrbpQ.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
test2@work's password:
Permission denied, please try again.
test2@work's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'test2@work'"
and check to make sure that only the key(s) you wanted were added.

test1@work:~$ ssh test2
ssh: Could not resolve hostname test2: Name or service not known
test1@work:~$ ssh test2@work
test2@work's password:
Permission denied, please try again.
test2@work's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
test2@work:~$ exit
Abgemeldet
Connection to work closed.
test1@work:~$ ssh test2@work
test2@work's password:
Permission denied, please try again.
test2@work's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
test2@work:~$ exit
Abgemeldet
Connection to work closed.
test1@work:~$ scp gpg-key
::1:                     gpg-key                  localhost:
bash01.txt               ip6-allnodes:            Musik/
bash02.txt               ip6-allrouters:          "Offentlich/
Bilder/                  ip6-localhost:           Schreibtisch/
Dokumente/               ip6-loopback:            Videos/
Downloads/               klartext.txt             Vorlagen/
entschluesselt.txt       klartext.txt.asc         work:
ff02::1:                 laptop-peaq:             work.ituenix.de:
ff02::2:                 laptop-peaq.ituenix.de:
test1@work:~$ scp gpg-key
::1:                     gpg-key                  localhost:
bash01.txt               ip6-allnodes:            Musik/
bash02.txt               ip6-allrouters:          "Offentlich/
Bilder/                  ip6-localhost:           Schreibtisch/
Dokumente/               ip6-loopback:            Videos/
Downloads/               klartext.txt             Vorlagen/
entschluesselt.txt       klartext.txt.asc         work:
ff02::1:                 laptop-peaq:             work.ituenix.de:
ff02::2:                 laptop-peaq.ituenix.de:
test1@work:~$ scp gpg-key klartext.txt.asc test2@work
test2@work: No such file or directory
test1@work:~$ scp gpg-key test2@work
test1@work:~$ scp klartext.txt test2@work
test1@work:~$ scp klartext.txt test2@work:/home/test2
test2@work's password:
klartext.txt                                  100%   18    18.4KB/s   00:00
test1@work:~$ scp gpg-key  test2@work:/home/test2
test2@work's password:
gpg-key                                       100% 2436     7.0MB/s   00:00
test1@work:~$ ssh test2@work
test2@work's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
test2@work:~$ gpg --import
.bash_history  .bashrc        .face.icon     klartext.txt
.bash_logout   .face          gpg-key        .profile
test2@work:~$ gpg --import gpg-key
gpg: Verzeichnis `/home/test2/.gnupg' erzeugt
gpg: Die "Keybox" `/home/test2/.gnupg/pubring.kbx' wurde erstellt
gpg: /home/test2/.gnupg/trustdb.gpg: trust-db erzeugt
gpg: Schl"ussel 253EEF1786033D77: "Offentlicher Schl"ussel "David Vajda <david@ituenix.de>" importiert
gpg: Anzahl insgesamt bearbeiteter Schl"ussel: 1
gpg:                              importiert: 1
test2@work:~$ gpg --list-keys
/home/test2/.gnupg/pubring.kbx
------------------------------
pub   rsa3072 2024-09-16 [SC]
      1572223D8E74D9BD4646849B253EEF1786033D77
uid        [ unbekannt ] David Vajda <david@ituenix.de>
sub   rsa3072 2024-09-16 [E]

test2@work:~$ gpg --encrypt -a recipient 1572223D8E74D9BD4646849B253EEF1786033D77 klartext.txt
Aufruf: gpg [Optionen] --encrypt [filename]
test2@work:~$ gpg --encrypt -a --recipient 1572223D8E74D9BD4646849B253EEF1786033D77 klartext.txt
gpg: 3C07FE8630CCACE9: Es gibt keine Garantie, da"s dieser Schl"ussel wirklich dem angegebenen Besitzer geh"ort.

sub  rsa3072/3C07FE8630CCACE9 2024-09-16 David Vajda <david@ituenix.de>
 Haupt-Fingerabdruck  = 1572 223D 8E74 D9BD 4646  849B 253E EF17 8603 3D77
 Unter-Fingerabdruck  = AB07 EF1C 96C7 5139 6B4C  813B 3C07 FE86 30CC ACE9

Es ist NICHT sicher, da"s der Schl"ussel zu dem in der User-ID
Genannten geh"ort. Wenn Sie *wirklich* wissen, was Sie tun,
k"onnen Sie die n"achste Frage mit ja beantworten

Diesen Schl"ussel trotzdem benutzen? (j/N) j
test2@work:~$ ls
gpg-key  klartext.txt  klartext.txt.asc
test2@work:~$ cat klartext.txt.asc
-----BEGIN PGP MESSAGE-----

hQGMAzwH/oYwzKzpAQv9GtkKNit8Qy/k1ago673M+mHCQyer+HnuV0M+nlT+KPdS
1ygnbj+yJFvqikuFj1T1/UuMr+HXov8pK+tyyeeLDxCPBYmwKf8LZLdUFa+yQIpG
WcZpB26NreeYb3o69E5W0LqpXDTz7tMitGWQmdBnpkDV79eKi7sj+hlrTPUr+Q17
uf52Z1tLZllz0E34KHTYBhNzdc2SIwH8CIcGqRECmTrMPSyWk+jXXJHeueXS87ke
HSfwROw1zAlUSLJiwM6N2bA9djXxGycAZHpLXXVlJErH45Me4sATZc3/1pVt/GCR
i1iWWwJYBgjGq6DOPAqvayBjciDtU1r3mBtEnLaTsCsbgY661VnRch+8APPGxNkK
jcFp6ivVOrGmnbBtEPboHrc1MQKglCSxzi6Xu+bKyIVNE8BIO6zM1U5VOpMnKDG7
GB9YLvr4HqU1cV7JtNap0gXlB1dvNpcEqGHEUIc7YjhipuYo57gMKFG8jGICD2c6
l7jH+N75FrBdbJr31d1b0lMB+pVhhnil8Rw8+vAz0U8YsdAO+rFuIBlP+3e/dgbv
a8RnJqKHf6fvd7sIBnPkytsOFgDXNvj/rquuMjVn2mtgSwmy8lWev+KsxxQJKz70
yllM9A==
=qdrw
-----END PGP MESSAGE-----
test2@work:~$ scp klartext.txt.asc test1@work:/home/test1/unklar.txt.asc
The authenticity of host 'work (127.0.1.1)' can't be established.
ED25519 key fingerprint is SHA256:lDSmxfFV1ZAhBshE3UPQC15YWKRq6g6kAanqIwvrbpQ.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'work' (ED25519) to the list of known hosts.
test1@work's password:
klartext.txt.asc                              100%  720     2.3MB/s   00:00
test2@work:~$ exit
Abgemeldet
Connection to work closed.
test1@work:~$ gpg --decrypt unklar.txt.asc
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
gpg: verschl"usselt mit 3072-Bit RSA Schl"ussel, ID 3C07FE8630CCACE9, erzeugt 2024-09-16
      "David Vajda <david@ituenix.de>"
Dies ist klartext
test1@work:~$ gpg --decrypt unklar.txt.asc > klart.txt
gpg: WARNUNG: Unsichere Zugriffsrechte des Home-Verzeichnis `/home/test1/.gnupg'
gpg: verschl"usselt mit 3072-Bit RSA Schl"ussel, ID 3C07FE8630CCACE9, erzeugt 2024-09-16
      "David Vajda <david@ituenix.de>"
test1@work:~$ cat klart.txt
Dies ist klartext
test1@work:~$