5 résultats taggé pgp

OpenPGP - Une paire de clés presque parfaite

  1. Création de la clé principale: gpg2 --expert --full-gen-key
  2. Création des sous-clés, une dédiée à chaque tâche : Authentification (A), Signature (S), Chiffrement (E) :
    gpg2 --expert --edit-key 1A8132B1
    gpg> addkey
  3. Exporter la clé principale et un certificat de révocation :
    gpg2 --output 1A8132B1.rev --gen-revoke 1A8132B1
    gpg2 --export --armor 1A8132B1 > 1A8132B1.pub.asc
    gpg2 --export-secret-keys --armor 1A8132B1 > 1A8132B1.priv.asc
    gpg2 --export-secret-subkeys --armor 1A8132B1 > 1A8132B1.sub_priv.asc
  4. Supprimer les clés privées:
    gpg2 --delete-secret-key 1A8132B1
    gpg2 --import 1A8132B1.sub_priv.asc # Uniquement les sous-clés

Bonnes pratiques pour l'utilisation d'OpenPGP

  1. Utilisez le groupe de serveurs de clés sks plutôt qu’un seul serveur, et utilisez des connexions sécurisées dans ~/.gnupg/gpg.conf:
    keyserver hkps://hkps.pool.sks-keyservers.net
    keyserver-options ca-cert-file=/chemin/vers/CA/sks-keyservers.netCA.pem
  2. Assurez-vous que toutes les clés sont rafraîchies à l’aide du serveur de clés que vous avez sélectionné: keyserver-options no-honor-keyserver-url dans ~/.gnupg/gpg.conf.
  3. Rafraîchissez vos clés l’une après l’autre: sudo apt-get install parcimonie
  4. Ne faites pas aveuglément confiance aux clés des serveurs de clés.
  5. Ne vous fiez pas à l’identifiant de clé.
  6. Vérifier l’empreinte d’une clef avant de l’importer: gpg --with-fingerprint <keyfile>
  7. Utilisez un délai d’expiration de deux ans ou moins.
  8. N’utilisez votre clé primaire que pour certifier (et éventuellement signer). Utilisez une sous-clé différente pour le chiffrement.

Creating the perfect GPG keypair

Subkeys help protect your identity in case of private key (laptop) theft

  1. Creating your initial keypair: gpg --full-generate-key
  2. Adding a picture:
    gpg --edit-key
    gpg> addphoto
    gpg> save
  3. Strengthening hash preferences: gpg> setpref SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
  4. Adding a new signing subkey: gpg> addkey, then select RSA (sign only)
  5. Creating a revocation certificate: gpg --output \<bilbo@shire.org\>.gpg-revocation-certificate --gen-revoke bilbo@shire.org
  6. Exporting the final product:
    gpg --export-secret-keys --armor bilbo@shire.org > \<bilbo@shire.org\>.private.gpg-key
    gpg --export --armor bilbo@shire.org > \<bilbo@shire.org\>.public.gpg-key

Transforming your master keypair into your laptop keypair

  1. Export all of the subkeys from our new keypair to a file: gpg --export-secret-subkeys bilbo@shire.org > /tmp/gpg/subkeys
  2. Delete the original signing subkey from the keypair in our keyring: gpg --delete-secret-key bilbo@shire.org
  3. Re-import the keys we exported: gpg --import /tmp/gpg/subkeys

In case of emergency

  1. Unlock your safe-deposit box and get your master keypair out.
  2. Boot a live USB of Ubuntu or your distro of choice. Then, import your master keypair into the live USB’s keyring: gpg --import /path/to/\<bilbo@shire.org\>.public.gpg-key /path/to/\<bilbo@shire.org\>.private.gpg-key
  3. Now use gpg --edit-key to interactively revoke your subkeys: gpg> revkey
  4. Now that your subkey has been revoked, you have to tell the world about it by distributing your key to a keyserver.

OpenPGP User ID Comments considered harmful

Comments are "part of the user's identity". Only that.

Changing the expiry date of GPG keys

Get the key ID:

gpg --list-keys yom.li

Then edit the key:

gpg --edit-key ABCDEF12

Then type expire:

gpg> expire

Then verify the new expiry date:

gpg> list

The edit procedure is for one key only (key 0 by default), so we need to set expire on all keys:

gpg> key 1
gpg> expire

And so on. Then save:

gpg> save
gpg --keyserver pgp.mit.edu --send-keys ABCDEF12