Edit: Sorry for the confusion. Actually I want to know whether it is possible to encrypt using private key. (This automatically means signing too.)
I wish to do this in a C program by running a script.
btw, is encrypting with private key a good idea to send a signed message to audience which will decrypt it with my public key ?
Old question:
How to “sign” a file with gpg using my own private key in GNU/Linux? I saw the man page but it doesn’t give any info about this.
Also, how the other party verify my signature created in this manner?
Please give the command line options to accomplish this, if it is possible.
I saw other questions on SO but they talk about Android, JAVA etc. I want just command line options.
thx.
The man page actually does give info about signing.
There are 3 main choices:
-s/--sign-aASCII armor option-s/--signAND with--clearsign-b/--detach-sign-aHere’s an example of me doing each in turn and then verifying.
Embedded signature, modifying the original file (requiring use of
gpg -dto get at the original contents of the file).Wrapping clearsign signature.
Detached signature (requiring the same name as the signed file, plus an extension of
.sigor.ascOR requiring the user to explicitly specify both the detached-sig-file and the signed file).So that should cover that.
For future reference, this question should not have been posted on Stackoverflow and will probably be moved or closed. It belongs on Unix and Linux or Superuser.