It is time again for me to renew my GPG keys and I wanted to write something about GnuPG/GPG and YubiKey for a while now. I want to go over some things I think someone should know, if they want to use GPG and a YubiKey for GPG. If I think there are good resource for learning about certain aspects, I will link to them.
What this is not This does not explain basics of cryptography. I assume you know about asymmetric and symmetric encryption, and signing (basically reverse asymmetric encryption of the contents hash). It also is not a guide on how to use GPG on a normal day. You probably already know how to that. Take a look at signing your git commits and using it for SSH authentication! This does not recommend any hardware. This does not take a look at signing git commits with SSH (though that is a interesting topic imo). This does not go over installation of GPG or tooling around using a smartcard (e.g. pcscd and pcsc_scan, ykman, kdf-setup, etc.) — maybe later. This also does not go over thread modeling. You need to know if an intelligence service is after you, if data corruption is a risk, etc. Be Serious If you are serious about using GPG, you should understand more than just how to give your key to an application to use it to sign/(de)crypt for you. I would recommend you never set the expiration of more than one year. Get comfortable with generating and renewing GPG keys. Never create a non-expiring key; this is because in case you loose access to the secret key (e.g. forgetting the password), the key will still be invalidated eventually.
I would also recommend understanding more about the anatomy and though behind the workings of GPG. I really liked Neal Walfield’s Advanced Intro to GnuPG.
...