Gnu Privacy Guard (GnuPG) Mini Howto (English): Encrypt and decrypt

Next Previous Contents

## 4. Encrypt and decrypt

After installing everything and configuring everything in the way we want, we can start on encrypting and decrypting.

When encrypting or decrypting it is possible to have more than one private key in use. If this occurs you need to select the active key. This can be done by using the option `-u UID` or by using the option `--local-user UID`. This causes the default key to use to be replaced by wanted key.

If you want to change recipient this can be done by the option `-r` or by the option `--recipient`.

## 4.1 Encrypt

The command to encrypt is

> `

>     gpg -e Recipient [Data]

> `

or

> `

>     gpg --encrypt Recipient [Data]

> `

To avoid the risk that somebody else claims to be you, it is very useful to sign everything you encrypt, see signatures.

## 4.2 Decrypt

The command for decrypting is:

> `

>     gpg [-d] [Data]

> `

or

> `

>     gpg [--decrypt] [Data]

> `

Also here `stdout` is preset, but with the `-o` option you can redirect the output to a file.

Next Previous Contents