githubEdit

GPG (GNU Privacy Guard)

GPG is a free-software replacement for Symantec's PGP cryptographic software suite.

Decrypt

1. Crack Passphrase from Private Key

  • gpg2john

    First of all, you need to format the private key to make the John to recognize it.

    gpg2john private.key > key.txt
    gpg2john private_key.asc > key.txt
    gpg2john private_key.sig > key.txt

    Crack the passphrase using the formatted text.

    john --wordlist=wordlist.txt key.txt
  • custom script

    If you cannot crack the passphrase using gpg2john for some reasons (error, etc), you can use the scriptarrow-up-right as alternative.

    ./crackgpg.sh example.gpg passwords.txt

2. Import the Private Key

gpg --import private.key
gpg --import private_key.asc
gpg --import private_key.sig

To list the imported keys,

3. Decrypt GPG (PGP) using the Passphrase

At that time, you'll be asked for the passphrase, so enter the passphrase you gotten in the previous section.

Decrypt ASC File

We can decrypt .asc file by importing private key.

Encrypt

We can encrypt a message using a PGP public key.

1. Import a Public Key

If we have already a public key, we can import it by the following command.

To list public keys, run the following command.

2. Encrypt a Message

If the public key was added, we can encrypt a message using it.

After that, hello.txt.gpg will be generated.

Sign

To sign a message with GPG, of course we need to GPG keys. We can generate a public/secret key by running the command below.

To display the contents of the public key, run the following command.

After that, we can sign a message using the public key. At this time, we’re asked for a passphrase, so we need to enter it.

Delete Keys

First off, we can list existing keys as below.

To delete specific key, run the following commands.

Last updated