Skip to Main Content
Linux Security Cookbook
book

Linux Security Cookbook

by Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
June 2003
Intermediate to advanced content levelIntermediate to advanced
336 pages
8h 54m
English
O'Reilly Media, Inc.
Content preview from Linux Security Cookbook

7.12. Signing a Text File

Problem

You want to attach a digital signature to a text file to verify its authenticity, leaving the file human-readable.

Solution

$ gpg --clearsign myfile

You’ll be prompted for your passphrase.

Discussion

If your original file has this content:

Hello world!

then the signed file will look something like this:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello world!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9WFNU5U0ZSgD1tx8RAkAmAJ4wWTKWSy6C30raF2RWfQ6Eh8ZXAQCePUW3
N9JVeHSgYuSFu6XPLKW+2XU=
=5XaU
-----END PGP SIGNATURE-----

Anyone who has your public key can check the signature in this file using gpg, thereby confirming that the file is from you. [Recipe 7.15]

See Also

gpg(1).

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Administration Cookbook

Linux Administration Cookbook

Adam K. Dean

Publisher Resources

ISBN: 0596003919Errata Page