4

If I use gpg --detach-sig file, then I get a small file.sig, but it is not plain text, so this is not useful if you wish to send the signature in a plain text format.

If I use gpg --clearsign file, then I get file.asc which contains the whole file plus a plain text signature at the end of the file. For viewing the signature, this is not easy if the payload is something other than text, since you can't open the file as plain text if your text editor can't handle the raw payload data. And I would prefer the payload and signature be separate files.

If I use both of the arguments at once, gpg --detach-sig --clearsign file, it behaves identically to only --clearsign, basically ignoring --detach-sig.

How can I create a detached plain text GPG signature?

3
  • Your question seems a little bit unclear to me. Could you clarify what do you mean by so this is not useful if you wish to send the signature in a plain text format. ?
    – n0idea
    Apr 4 '19 at 9:58
  • 1
    Are you looking for --armor? Apr 4 '19 at 13:10
  • @n0idea I want to be able to upload the signature into a box that only accepts ASCII. Apr 4 '19 at 18:29
10

The command you want is:

gpg --detach-sig --armor file

This will create a detached signature and will armor it, i.e. encode it with ASCII.

See the GnuPG documentation for more information.

2
  • This is it, thank you so much! Sorry I forgot to accept your answer earlier. Jan 9 '20 at 4:47
  • This is exactly what I wanted!
    – danger89
    Apr 6 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.