Using PGP keys to make your files yours
In this post, i will explain to you how to setup your own PGP key and use it.
What is a PGP key?
PGP signs are a great way to demonstrate that a file is made and distributed by you, or, for example, signing a git commit message. In fact, Github detects if a commit is made by you by making use of pgp signing. This is thanks to the use of cryptographic signatures.
Generating your own key
Once we know what PGP keys are, we can start by generating our first key. First of all, we need to have GnuPG installed. You can check it by running
which gpg
gpg --full-generate-key
Important commands and tips
You can share your own gpg sign by using the following command:
gpg --export --armor [email protected] > public-key.asc
gpg --import your-key.asc
gpg --export-secret-keys --armor [email protected] > private-key.asc
gpg --symmetric --cipher-algo AES256 private-key.asc
gpg --decrypt private-key.asc.gpg > private-key.asc
# Importing
gpg --import private-key.asc
# Setting a new passphrase (optional, but highly recommended)
gpg --edit-key [email protected]
gpg --gen-revoke [email protected] > revoke-cert.asc
Signing your commits and tags for git
First of all, check what is the key id of your gpg key. You can use this command.
gpg --list-secret-keys --keyid-format LONG
git config --global user.signingkey KEY_ID
git config --global commit.gpgsign true
gpg --armor --export KEY_ID
Conclusion
PGP keys are crucial to make a more secure world. That's why i recommend you to create your own key.