To sign data with your own key, use the command:
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 -s (or --sign) [Data]
this will make sure that the results are clearly legible. Furthermore it does the same (signing data).
gpg --clearsign [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
gpg -b (or --detach-sign) [Data]
--armoroption 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
--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:
This will only work (of course) when you own the public key of the sender.
gpg [--verify] [Data]