How to use GPG?
2 min read
Photo by regularguy.eth on Unsplash
How to create key?
Simply we can run this:
Then we will have some interactives.
It's optional, but I oftenly use RSA and RSA (number 1)
It's more secure to have more bit or simply we can take the maximum bit, let's say maximum number is 4096, then we can put 4096
If we want to use this key on all the time, we can set to
0to have the never expired key.
let say I set
0as the expiration date which mean it will never get expired, then it will try to confirm us that we really want to create a key which never get expired.
Put your name, minimum length is 5.
You'll never get email for this, it's just for identification purposes. (optional)
Just another information we want to put, maybe to identifying something. (optional)
It will ask you to confirm your identity, we can input
O(O / Oscar character) to confirm that it's correct.
Finally we can put password for the created key, we're going to need this password to decrypt encrypted file.
How to Encrypt file?
gpg -r <uid> -e your-whatever-file.zip
replace <uid> with your created key, then a new file with the
.gpg extension will be created.
How to Decrypt File?
gpg -d your-whatever-file.zip.gpg
or if we want to put the unlocked data into a file, we can use
gpg -d your-whatever-file.zip.gpg > your-whatever-file.zip
How to List all existing keys?
or we can just specify a <uid> to know the information of specific key
gpg --list-keys <uid>
How to Export Key?
gpg --export-secret-keys <uid> > output.key
You're going to type your password to able to export the key.
How to Import Key?
gpg --import output.key
How to Delete Key?
to be able to delete the keys, we need to delete the secret key first, then deleting the key.
gpg --delete-secret-keys <uid> gpg --delete-keys <ui>
Did you find this article valuable?
Support Fiko Borizqy by becoming a sponsor. Any amount is appreciated!