Table des matières
GPG - Utilisation basique - exemples
Documentation :
Procédure simple chiffrer un message ou un fichier :
Recommandations :
Autre :
Voir :
Importer une clef
Importer une clef localement
gpg --import correspondant.pgp
Importer une clef via Internet
Tscoks et Tor doivent être installés et configurés Voir tor_tsocks
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
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)
gpg --detach-sign data.dat.gpg
On vérifie la signature
gpg --verify data.dat.gpg.sig data.dat.gpg
Si la signature est bonne, on déchiffre
gpg --decrypt data.dat.gpg
Exemple en ligne de commande
Signé et chiffré
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]
gpg plop.txt.gpg && echo OK
Nous retrouvons le fichier plop.txt
Avancée
Commandes passives
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)
gpg --list-packets public-key.asc
Avoir des informations sur un fichier chiffré
gpg report.txt.gpg
Autres conversions formats
Uuencode / uudecode Pour encoder, il suffit de taper :
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:
gpg chemin/nom_du_fichier.ext.asc
convert .asc to .gpg (and eventually vice-versa)
gpg --dearmor the-asc-file.asc
will convert from .asc to .gpg
cat the-gpg-file.gpg | gpg --enarmor | sed 's|ARMORED FILE|MESSAGE|' > my-new-asc-file.asc
printf 'Key-Type: DSA\nKey-Length: 4096\nName-Real: test\n' | ./gpg --batch –gen-key
