mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 12:00:56 +01:00
changed detach sig verification commandline (-a => -f <file>)
This commit is contained in:
29
src/pcp.c
29
src/pcp.c
@@ -99,17 +99,17 @@ int main (int argc, char **argv) {
|
||||
|
||||
// globals
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, 'f' },
|
||||
{ "version", no_argument, NULL, 'v' },
|
||||
{ "debug", no_argument, NULL, 'D' },
|
||||
|
||||
// signing
|
||||
{ "sign", no_argument, NULL, 'g' },
|
||||
{ "check-signature", optional_argument, NULL, 'c' },
|
||||
{ "detach", no_argument, NULL, 'a' },
|
||||
{ "check-signature", no_argument, NULL, 'c' },
|
||||
{ "sigfile", required_argument, NULL, 'f' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "klV:vdehsO:i:I:pSPRtEx:DzZr:gc::yma",
|
||||
while ((opt = getopt_long(argc, argv, "klV:vdehsO:i:I:pSPRtEx:DzZr:gcymf:",
|
||||
longopts, NULL)) != -1) {
|
||||
|
||||
switch (opt) {
|
||||
@@ -175,21 +175,19 @@ int main (int argc, char **argv) {
|
||||
case 'Z':
|
||||
armor = 1;
|
||||
break;
|
||||
case 'a':
|
||||
detach = 1;
|
||||
break;
|
||||
case 'g':
|
||||
mode += PCP_MODE_SIGN;
|
||||
usevault = 1;
|
||||
break;
|
||||
case 'c':
|
||||
mode += PCP_MODE_VERIFY;
|
||||
if(optarg) {
|
||||
sigfile = ucmalloc(strlen(optarg)+1);
|
||||
strncpy(sigfile, optarg, strlen(optarg)+1);
|
||||
}
|
||||
usevault = 1;
|
||||
break;
|
||||
case 'f':
|
||||
sigfile = ucmalloc(strlen(optarg)+1);
|
||||
strncpy(sigfile, optarg, strlen(optarg)+1);
|
||||
detach = 1;
|
||||
break;
|
||||
case 'y':
|
||||
mode += PCP_MODE_YAML;
|
||||
usevault = 1;
|
||||
@@ -393,7 +391,14 @@ int main (int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case PCP_MODE_SIGN:
|
||||
pcpsign(infile, outfile, xpass, armor, detach);
|
||||
if(detach) {
|
||||
if(outfile != NULL && sigfile != NULL)
|
||||
fatal("You can't both specify -O and -f, use -O for std signatures and -f for detached ones\n");
|
||||
else
|
||||
pcpsign(infile, sigfile, xpass, armor, detach);
|
||||
}
|
||||
else
|
||||
pcpsign(infile, outfile, xpass, armor, detach);
|
||||
break;
|
||||
|
||||
case PCP_MODE_VERIFY:
|
||||
|
||||
@@ -115,7 +115,7 @@ int pcpverify(char *infile, char *sigfile, char *id, int detach) {
|
||||
if(detach)
|
||||
pub = pcp_ed_detachverify_buffered(in, sigfd, pub);
|
||||
else
|
||||
pub = pcp_ed_verify_buffered(sigfd, pub);
|
||||
pub = pcp_ed_verify_buffered(in, pub);
|
||||
|
||||
if(pub != NULL)
|
||||
fprintf(stderr, "Signature verified (signed by %s <%s>).\n", pub->owner, pub->mail);
|
||||
|
||||
@@ -98,11 +98,11 @@
|
||||
" the file specified with -I (or stdin).\n" \
|
||||
" The public key required for this must\n" \
|
||||
" exist in your vault file.\n" \
|
||||
"-a --detach Write a detached signature file, which doesn't\n" \
|
||||
"-f --sigfile <file> Write a detached signature file, which doesn't\n" \
|
||||
" contain the original content. Output will be\n" \
|
||||
" z85 encoded always. To verify, you need to\n" \
|
||||
" specify the original file to be verified\n" \
|
||||
" against using -I as well (plus -a).\n" \
|
||||
" against using -I as well (plus -f <sigfile>).\n" \
|
||||
"\n" \
|
||||
"Encoding Options:\n" \
|
||||
"-z --z85-encode Encode something to Z85 encoding. Use\n" \
|
||||
|
||||
@@ -96,11 +96,11 @@ Signature Options:
|
||||
the file specified with -I (or stdin).
|
||||
The public key required for this must
|
||||
exist in your vault file.
|
||||
-a --detach Write a detached signature file, which doesn't
|
||||
-f --sigfile <file> Write a detached signature file, which doesn't
|
||||
contain the original content. Output will be
|
||||
z85 encoded always. To verify, you need to
|
||||
specify the original file to be verified
|
||||
against using -I as well (plus -a).
|
||||
against using -I as well (plus -f <sigfile>).
|
||||
|
||||
Encoding Options:
|
||||
-z --z85-encode Encode something to Z85 encoding. Use
|
||||
|
||||
Reference in New Issue
Block a user