Skip to content

Instantly share code, notes, and snippets.

@kantrveysel
Last active December 19, 2025 07:07
Show Gist options
  • Select an option

  • Save kantrveysel/383719caf539fc5745d7bd8a08da608c to your computer and use it in GitHub Desktop.

Select an option

Save kantrveysel/383719caf539fc5745d7bd8a08da608c to your computer and use it in GitHub Desktop.
GPG Quick Guide (WSL / Ubuntu)

GPG Quick Guide (WSL / Ubuntu)

Bu notlar, WSL (Ubuntu) üzerinde GPG kullanımı, anahtar yönetimi, imzalama, şifreleme ve Web of Trust mantığını kapsar.


Kurulum (WSL / Ubuntu)

sudo apt update
sudo apt install -y gnupg

Kontrol:

gpg --version

1️⃣ GPG Anahtarı Oluşturma

1.1 Anahtar üret

gpg --full-generate-key

Önerilen seçenekler:

Please select what kind of key you want:
(1) RSA and RSA

What keysize do you want?
4096

Key is valid for?
0

Real name:
Name Surname

Email address:
other_user@example.com

Comment:
Plotune Signing Key

Passphrase belirle (zorunlu ve kritik).


1.2 Anahtarları listele

gpg --list-keys

Örnek çıktı:

pub   rsa4096 2025-01-01 [SC]
      ABCD1234EFGH5678....
uid   [ultimate] Name Surname <other_user@example.com>
sub   rsa4096 2025-01-01 [E]

Açıklamalar:

  • pub → public key
  • [SC] → sign + certify yetkisi
  • sub [E] → encryption subkey

2️⃣ Örnek Metin Dosyası

cat > message.txt <<EOF
Merhaba,

Bu mesaj Plotune projesi kapsamında
GPG ile imzalanmıştır.

— Name
EOF

3️⃣ Metin İmzalama (SIGN)

3.1 Clear-sign (okunabilir)

gpg --clearsign message.txt

Üretilen dosya:

message.txt.asc

3.2 Detached signature (ayrı imza)

gpg --detach-sign message.txt

Üretilen dosya:

message.txt.sig

4️⃣ İmza Doğrulama (VERIFY)

Clear-sign:

gpg --verify message.txt.asc

Başarılıysa:

Good signature from "Name Surname <other_user@example.com>"

Detached signature:

gpg --verify message.txt.sig message.txt

5️⃣ Metni Şifreleme (ENCRYPT)

5.1 Kendine şifreleme (test)

gpg --encrypt --recipient other_user@example.com message.txt

Oluşur:

message.txt.gpg

5.2 İmzalı + şifreli (önerilen)

gpg --encrypt --sign --recipient other_user@example.com message.txt

Bu işlem:

  • Göndereni doğrular
  • İçeriği gizler
  • Değiştirilmediğini garanti eder

6️⃣ Şifreli Dosyayı Çözme (DECRYPT)

gpg --decrypt message.txt.gpg

Dosyaya yazmak için:

gpg --output decrypted.txt --decrypt message.txt.gpg

7️⃣ Key Certification (Web of Trust)

Bu işlem dosya imzalamak değildir.

“Bu public key’in gerçekten bu kişiye ait olduğunu doğruluyorum”

Başkasının key’ini onaylama

gpg --sign-key alice@example.com

8️⃣ Belirli Key ile İmzalama

Email ile:

gpg --local-user user@example.com --clearsign message.txt

Key ID ile:

gpg --local-user 1122334455667788 --clearsign message.txt

Plotune key’i ile:

gpg --local-user other_user@example.com --clearsign message.txt

9️⃣ Çoklu Kimlik (Root → Org Key Zinciri)

[ ROOT / PERSONAL KEY ]
user@example.com
       |
       |  (certification)
       v
[ ROLE / ORG KEY ]
other_user@example.com

Org key’i root key ile onayla

gpg --list-secret-keys --keyid-format=long
gpg --local-user user@example.com --sign-key other_user@example.com

🔟 Başkasının Key’ini İmzalama ve Paylaşma

gpg --import alice_public_key.asc
gpg --fingerprint alice@example.com
gpg --local-user user@example.com --sign-key alice@example.com

İmzalı key’i export et:

gpg --export alice@example.com > alice_signed_by_veysel.asc

Alice bunu:

  • Kendisi yayınlayabilir
  • Keyserver’a gönderebilir
gpg --import alice_signed_by_veysel.asc
gpg --send-keys alice@example.com

1️⃣1️⃣ Release / Paket İmzalama

Binary imzalama

gpg --detach-sign --armor plotune_installer.exe

Doğrulama:

gpg --verify plotune_installer.exe.asc plotune_installer.exe

Hash + imza (ekstra güvenlik)

sha256sum plotune_installer.exe > SHA256SUMS
gpg --clearsign SHA256SUMS

1️⃣2️⃣ Özet Tablo

İşlem Komut
Anahtar oluştur gpg --full-generate-key
Metin imzala gpg --clearsign file
İmza doğrula gpg --verify
Şifrele gpg --encrypt -r email file
Çöz gpg --decrypt file.gpg
Key onayla gpg --sign-key email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment