GPG: How to encrypt and decrypt

When you have the public key from your fiend, you can use it to encrypt your file by following steps:

  • Importing the public key:

gpg –import

  • Checking your public keys list:

gpg –list-keys

  • Encrypting your file:

gpg –encrypt –recipient

Otherwise, if you have a private key, you can decrypt the file which encrypted by a pair of public/private keys. Following these steps:

  • Importing the private key:

gpg –import

  • Checking your private keys list:

gpg –list-secret-keys

  • Decrypting your file:

gpg –decrypt >

Enter the passphrase if required.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s