Next Previous Contents

5. Signing and checking signatures

To sign data with your own key, use the command:

gpg -s (or --sign) [Data]
By doing this also compression takes place. This means that the result is not legible. If you want a legible result you can use:

gpg --clearsign [Data]
this will make sure that the results are clearly legible. Furthermore it does the same (signing data).


gpg -b (or --detach-sign) [Data]
you can write the signature in a separate file. It is highly recommended to use this option especially when signing binary files (like archives for instance). Also the --armor option can be extremely useful here.

Quite often you find that data is encrypted and signed as well. The full instruction looks like:

gpg [-u Sender] [-r Recipient] [--armor] --sign --encrypt [Data]

The functionality of the options -u (--local-user) and -r (--recipient) are as described before.

When encrypted data has been signed as well, the signature is checked when the data is decrypted. You can check the signature of signed data by using the command:

gpg [--verify] [Data]
This will only work (of course) when you own the public key of the sender.

Next Previous Contents