changed detach sig verification commandline (-a => -f <file>)

This commit is contained in:
git@daemon.de
2014-01-28 12:19:25 +01:00
parent 130177f6e9
commit ad009a8142
8 changed files with 47 additions and 28 deletions

View File

@@ -112,7 +112,11 @@ be Z85 encoded.
Example: Example:
pcp1 -g -I message.txt -O message.asc -g --detach pcp1 -g -I message.txt -O -g --sigfile message.sig
Verification by recipient:
pcp -c -f message.sig -I message.txt
=back =back

View File

@@ -124,7 +124,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PCP1 1" .IX Title "PCP1 1"
.TH PCP1 1 "2014-01-27" "PCP 0.2.0" "USER CONTRIBUTED DOCUMENTATION" .TH PCP1 1 "2014-01-28" "PCP 0.2.0" "USER CONTRIBUTED DOCUMENTATION"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@@ -231,11 +231,11 @@ Pretty Curved Privacy \- File encryption using eliptic curve cryptography.
\& the file specified with \-I (or stdin). \& the file specified with \-I (or stdin).
\& The public key required for this must \& The public key required for this must
\& exist in your vault file. \& exist in your vault file.
\& \-a \-\-detach Write a detached signature file, which doesn\*(Aqt \& \-f \-\-sigfile <file> Write a detached signature file, which doesn\*(Aqt
\& contain the original content. Output will be \& contain the original content. Output will be
\& z85 encoded always. To verify, you need to \& z85 encoded always. To verify, you need to
\& specify the original file to be verified \& specify the original file to be verified
\& against using \-I as well (plus \-a). \& against using \-I as well (plus \-f <sigfile>).
\& \&
\& Encoding Options: \& Encoding Options:
\& \-z \-\-z85\-encode Encode something to Z85 encoding. Use \& \-z \-\-z85\-encode Encode something to Z85 encoding. Use
@@ -436,7 +436,13 @@ be Z85 encoded.
Example: Example:
.Sp .Sp
.Vb 1 .Vb 1
\& pcp1 \-g \-I message.txt \-O message.asc \-g \-\-detach \& pcp1 \-g \-I message.txt \-O \-g \-\-sigfile message.sig
.Ve
.Sp
Verification by recipient:
.Sp
.Vb 1
\& pcp \-c \-f message.sig \-I message.txt
.Ve .Ve
.SH "SIGNED ENCRYPTION" .SH "SIGNED ENCRYPTION"
.IX Header "SIGNED ENCRYPTION" .IX Header "SIGNED ENCRYPTION"

View File

@@ -103,11 +103,11 @@ Pretty Curved Privacy - File encryption using eliptic curve cryptography.
the file specified with -I (or stdin). the file specified with -I (or stdin).
The public key required for this must The public key required for this must
exist in your vault file. 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 contain the original content. Output will be
z85 encoded always. To verify, you need to z85 encoded always. To verify, you need to
specify the original file to be verified specify the original file to be verified
against using -I as well (plus -a). against using -I as well (plus -f <sigfile>).
Encoding Options: Encoding Options:
-z --z85-encode Encode something to Z85 encoding. Use -z --z85-encode Encode something to Z85 encoding. Use
@@ -303,7 +303,11 @@ be Z85 encoded.
Example: Example:
pcp1 -g -I message.txt -O message.asc -g --detach pcp1 -g -I message.txt -O -g --sigfile message.sig
Verification by recipient:
pcp -c -f message.sig -I message.txt
=back =back

View File

@@ -99,17 +99,17 @@ int main (int argc, char **argv) {
// globals // globals
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'f' }, { "version", no_argument, NULL, 'v' },
{ "debug", no_argument, NULL, 'D' }, { "debug", no_argument, NULL, 'D' },
// signing // signing
{ "sign", no_argument, NULL, 'g' }, { "sign", no_argument, NULL, 'g' },
{ "check-signature", optional_argument, NULL, 'c' }, { "check-signature", no_argument, NULL, 'c' },
{ "detach", no_argument, NULL, 'a' }, { "sigfile", required_argument, NULL, 'f' },
{ NULL, 0, NULL, 0 } { 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) { longopts, NULL)) != -1) {
switch (opt) { switch (opt) {
@@ -175,20 +175,18 @@ int main (int argc, char **argv) {
case 'Z': case 'Z':
armor = 1; armor = 1;
break; break;
case 'a':
detach = 1;
break;
case 'g': case 'g':
mode += PCP_MODE_SIGN; mode += PCP_MODE_SIGN;
usevault = 1; usevault = 1;
break; break;
case 'c': case 'c':
mode += PCP_MODE_VERIFY; mode += PCP_MODE_VERIFY;
if(optarg) { usevault = 1;
break;
case 'f':
sigfile = ucmalloc(strlen(optarg)+1); sigfile = ucmalloc(strlen(optarg)+1);
strncpy(sigfile, optarg, strlen(optarg)+1); strncpy(sigfile, optarg, strlen(optarg)+1);
} detach = 1;
usevault = 1;
break; break;
case 'y': case 'y':
mode += PCP_MODE_YAML; mode += PCP_MODE_YAML;
@@ -393,6 +391,13 @@ int main (int argc, char **argv) {
break; break;
case PCP_MODE_SIGN: case PCP_MODE_SIGN:
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); pcpsign(infile, outfile, xpass, armor, detach);
break; break;

View File

@@ -115,7 +115,7 @@ int pcpverify(char *infile, char *sigfile, char *id, int detach) {
if(detach) if(detach)
pub = pcp_ed_detachverify_buffered(in, sigfd, pub); pub = pcp_ed_detachverify_buffered(in, sigfd, pub);
else else
pub = pcp_ed_verify_buffered(sigfd, pub); pub = pcp_ed_verify_buffered(in, pub);
if(pub != NULL) if(pub != NULL)
fprintf(stderr, "Signature verified (signed by %s <%s>).\n", pub->owner, pub->mail); fprintf(stderr, "Signature verified (signed by %s <%s>).\n", pub->owner, pub->mail);

View File

@@ -98,11 +98,11 @@
" the file specified with -I (or stdin).\n" \ " the file specified with -I (or stdin).\n" \
" The public key required for this must\n" \ " The public key required for this must\n" \
" exist in your vault file.\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" \ " contain the original content. Output will be\n" \
" z85 encoded always. To verify, you need to\n" \ " z85 encoded always. To verify, you need to\n" \
" specify the original file to be verified\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" \ "\n" \
"Encoding Options:\n" \ "Encoding Options:\n" \
"-z --z85-encode Encode something to Z85 encoding. Use\n" \ "-z --z85-encode Encode something to Z85 encoding. Use\n" \

View File

@@ -96,11 +96,11 @@ Signature Options:
the file specified with -I (or stdin). the file specified with -I (or stdin).
The public key required for this must The public key required for this must
exist in your vault file. 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 contain the original content. Output will be
z85 encoded always. To verify, you need to z85 encoded always. To verify, you need to
specify the original file to be verified specify the original file to be verified
against using -I as well (plus -a). against using -I as well (plus -f <sigfile>).
Encoding Options: Encoding Options:
-z --z85-encode Encode something to Z85 encoding. Use -z --z85-encode Encode something to Z85 encoding. Use

View File

@@ -212,7 +212,7 @@ dxmorg@florida.cops.gov
# #
# signature tests # signature tests
<test check-sign-detached-to-bobby> <test check-sign-detached-to-bobby>
cmd = $pcp -V va -g -I README -O testsig -x a -a cmd = $pcp -V va -g -I README -f testsig -x a
expect-file testsig expect-file testsig
</test> </test>
<test check-verify-detached-signature> <test check-verify-detached-signature>
@@ -225,7 +225,7 @@ dxmorg@florida.cops.gov
expect-file testsig expect-file testsig
</test> </test>
<test check-verify-armored-signature> <test check-verify-armored-signature>
cmd = $pcp -V vb -c testsig -i $idalicia -z cmd = $pcp -V vb -c -I testsig -i $idalicia -z
expect = /verified/ expect = /verified/
</test> </test>
<test check-sign-bin-to-bobby> <test check-sign-bin-to-bobby>
@@ -234,7 +234,7 @@ dxmorg@florida.cops.gov
expect-file testsig expect-file testsig
</test> </test>
<test check-verify-bin-signature> <test check-verify-bin-signature>
cmd = $pcp -V vb -c testsig -i $idalicia cmd = $pcp -V vb -c -I testsig -i $idalicia
expect = /verified/ expect = /verified/
</test> </test>