Outils pour utilisateurs

Outils du site


tech:gpg_-_utilisation_basique_-_exemples

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
tech:gpg_-_utilisation_basique_-_exemples [2025/03/24 15:06] – créée - modification externe 127.0.0.1tech:gpg_-_utilisation_basique_-_exemples [2026/06/29 15:32] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon}}
 +
 +# GPG - Utilisation basique - exemples
 +
 +Documentation : 
 +* https://www.gnupg.org/gph/fr/manual.html
 +* https://www.gnupg.org/howtos/fr/GPGMiniHowto.html
 +
 +Procédure simple chiffrer un message ou un fichier :
 +* https://emailselfdefense.fsf.org/fr/
 +* https://www.nist.gov/system/files/documents/2021/10/25/nist_encryption.pdf
 +* https://emailselfdefense.fsf.org/fr/index.html
 +* [Guide d’autodéfense numérique](https://guide.boum.org/)
 +* https://blog.eleven-labs.com/en/openpgp-almost-perfect-key-pair-part-1/
 +* https://linuxfr.org/news/bien-demarrer-avec-gnupg
 +
 +
 +Recommandations :
 +* https://infosec.mozilla.org/guidelines/key_management.html
 +* https://riseup.net/fr/security/message-security/openpgp/gpg-best-practices
 +
 +Autre :
 +* https://nipil.org/2013/09/19/GnuPG-plan-de-secours-valide.html
 +* https://linuxfr.org/users/gouttegd/journaux/de-la-gestion-des-clefs-openpgp
 +* [GNU Privacy Assistant (GPA)](https://docs.nitrokey.com/fr/pro/openpgp-keygen-gpa.html)
 +
 +Voir :
 +* http://math.cmu.edu/~svasey/old-homepage-archive-2013/projects/software-usage-notes/gpg_en.html
 +* http://keyring.debian.org/replacing_keys.html
 +* https://help.riseup.net/en/security/message-security/openpgp/best-practices
 +* https://we.riseup.net/riseuplabs+paow/openpgp-best-practices
 +* https://deekayen.net/large-gpg-keys
 +* http://www.ssi.gouv.fr/actualite/cryptanalyse-de-messages-openpgp-par-lexploitation-de-fragilites-cryptographiques-du-format/
 +
 +## Importer une clef
 +
 +Importer une clef localement
 +~~~bash
 +gpg --import correspondant.pgp
 +~~~
 +
 +Importer une clef via Internet
 +
 +Tscoks et Tor doivent être installés et configurés
 +Voir [[tor_tsocks]]
 +
 +~~~bash
 +tsocks gpg --recv-keys 5AA19646
 +~~~
 +
 +## Utilisation basique - exemples
 +
 +Exemple de chiffrement
 +noté `-R` à la place du `-r` pour caché qui est le destinataire du fichier
 +~~~bash
 +gpg -R jean@acme.fr --throw-keyids --encrypt data.dat 
 +~~~
 +
 +Ici nous signons le fichier `data.dat.gpg` (crée la commande précédente)
 +~~~bash
 +gpg --detach-sign data.dat.gpg
 +~~~
 +
 +On vérifie la signature
 +~~~bash
 +gpg --verify data.dat.gpg.sig data.dat.gpg
 +~~~
 +
 +Si la signature est bonne, on déchiffre
 +~~~bash
 +gpg --decrypt data.dat.gpg
 +~~~
 +
 +---------
 +
 +### Exemple en ligne de commande
 +
 +#### Signé et chiffré
 +~~~bash
 +gpg --sign plop.txt
 +gpg --encrypt -R jean@acme.fr plop.txt.gpg
 +mv plop.txt.gpg.gpg plop
 +~~~
 +
 +On envoie notre fichier plop
 +
 +#### Déchiffrement et vérification signature
 +~~~
 +$ gpg plop
 +gpg: plop : suffixe inconnu
 +Entrez le nouveau nom de fichier [plop.txt.gpg]:
 +~~~
 +
 +Faire **[Entrée]**
 +~~~bash
 +gpg plop.txt.gpg && echo OK
 +~~~
 +
 +Nous retrouvons le fichier `plop.txt`
 +
 +## Avancée
 +
 +## Commandes passives
 +
 +
 +~~~bash
 +gpg --with-fingerprint --list-secret-key
 +gpg --list-keys your_email@address.com
 +
 +echo 'foo' | gpg --recipient [key-id] --encrypt --sign | gpg --list-packets
 +~~~
 +
 +Avoir plus d'information sur une clefs (sans l’importer)
 +~~~bash
 +gpg --list-packets public-key.asc
 +~~~
 +
 +Avoir des informations sur un fichier chiffré
 +~~~bash
 +gpg report.txt.gpg
 +~~~
 +
 +
 +## Autres conversions formats 
 +
 +Uuencode / uudecode
 +Pour encoder, il suffit de taper :
 +
 +~~~bash
 +gpg -a --store chemin/nom_du_fichier.ext
 +~~~
 +(Cela produira en sortie chemin/nom_du_fichier.ext.asc)
 +
 +Pour décoder, c’est encore plus simple:
 +~~~bash
 +gpg chemin/nom_du_fichier.ext.asc
 +~~~
 +
 +convert .asc to .gpg (and eventually vice-versa)
 +
 +~~~bash
 +gpg --dearmor the-asc-file.asc
 +~~~
 +
 +will convert from .asc to .gpg
 +~~~bash
 +cat the-gpg-file.gpg | gpg --enarmor | sed 's|ARMORED FILE|MESSAGE|' > my-new-asc-file.asc
 +~~~
 +
 +~~~bash
 +printf 'Key-Type: DSA\nKey-Length: 4096\nName-Real: test\n' | ./gpg --batch –gen-key
 +~~~
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki