How to use GPG?

I wrote these tutorials for myself in future when I forget for the next steps.
Search for a command to run...

I wrote these tutorials for myself in future when I forget for the next steps.
No comments yet. Be the first to comment.
When you provision an Ubuntu instance on Oracle Cloud, you'll notice something different from standard Ubuntu installations: the system uses iptables instead of ufw for firewall management. This disti

When developing web applications locally, HTTPS is often overlooked. Yet, modern browsers and APIs increasingly require secure connections—even in development. That’s where mkcert comes in: a simple t

Testing the checkout success page in Magento 2 can be frustrating. By default, once an order is placed, Magento clears the quote session, meaning you can’t simply refresh or revisit the success page without going through the entire checkout process a...

Magento Commerce (EE) offers powerful features, but for many teams, Open Source (CE) is leaner, lighter, and more sustainable. If you're migrating from EE to CE, the Opengento downgrade tool provides a clean, scriptable way to remove proprietary modu...

If you’ve ever checked your Apache error logs and seen something like this: Code [core:error] (13)Permission denied: access to /robots.txt denied (filesystem path '/home/username/sites') because search permissions are missing on a component of the pa...

Simply we can run this:
gpg --full-gen-key
Then we will have some interactives.
Key Type
It's optional, but I oftenly use RSA and RSA (number 1)
Keysize (Bits)
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
Expiration Time
If we want to use this key on all the time, we can set to 0 to have the never expired key.
Expiration confirmation
let say I set 0 as 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.
Identity
Name
Put your name, minimum length is 5.
You'll never get email for this, it's just for identification purposes. (optional)
Comment
Just another information we want to put, maybe to identifying something. (optional)
Identity confirmation
It will ask you to confirm your identity, we can input O (O / Oscar character) to confirm that it's correct.
Password
Finally we can put password for the created key, we're going to need this password to decrypt encrypted 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.
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
gpg --list-keys
or we can just specify a <uid> to know the information of specific key
gpg --list-keys <uid>
gpg --export-secret-keys <uid> > output.key
You're going to type your password to able to export the key.
gpg --import output.key
Or use gpg2 if you don’t want to input passphrase
gpg2 --batch --import output.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>
References: