From 7f4bccfaff731292f7ce05ce721f4dc6fb80ab8f Mon Sep 17 00:00:00 2001 From: "git@daemon.de" Date: Fri, 7 Feb 2014 11:55:44 +0100 Subject: [PATCH] updated pod --- README.pod | 4 +-- README.txt | 4 +-- include/pcp.h | 1 + man/details.pod | 85 +++++++++++++++++++++++++++++++++++++++---- man/footer.pod | 4 +-- man/pcp1.pod | 95 ++++++++++++++++++++++++++++++++++++++++++++----- src/pcp.c | 80 +++++++++++++++++++++++++++++++++++++++++ src/usage.h | 6 ++++ src/usage.txt | 6 ++++ 9 files changed, 265 insertions(+), 20 deletions(-) diff --git a/README.pod b/README.pod index 9bcd077..cb4c045 100644 --- a/README.pod +++ b/README.pod @@ -105,7 +105,7 @@ To learn how to use B, read the manpage: =head1 COPYRIGHT -Copyright (c) 2013 by T.Linden +Copyright (c) 2013-2014 by T.v.Dein =head1 ADDITIONAL COPYRIGHTS @@ -144,7 +144,7 @@ under the B as well. =head1 AUTHORS -I> +I> =head1 LICENSE diff --git a/README.txt b/README.txt index 8a08fa4..2b0536b 100644 --- a/README.txt +++ b/README.txt @@ -97,7 +97,7 @@ DOCUMENTATION man pcp1 COPYRIGHT - Copyright (c) 2013 by T.Linden + Copyright (c) 2013-2014 by T.v.Dein ADDITIONAL COPYRIGHTS ZeroMQ Z85 encoding routine @@ -125,7 +125,7 @@ ADDITIONAL COPYRIGHTS as well. AUTHORS - *T.Linden + *T.v.Dein LICENSE Licensed under the GNU GENERAL PUBLIC LICENSE version 3. diff --git a/include/pcp.h b/include/pcp.h index 4d1e210..13ffc04 100644 --- a/include/pcp.h +++ b/include/pcp.h @@ -6,6 +6,7 @@ extern "C" { #endif #include "pcp/base85.h" +#include "pcp/config.h" #include "pcp/crypto.h" #include "pcp/defines.h" #include "pcp/digital_crc32.h" diff --git a/man/details.pod b/man/details.pod index bfc9cfb..63292a7 100644 --- a/man/details.pod +++ b/man/details.pod @@ -1,4 +1,3 @@ -# -*-perl-*- =head1 PCP1 KEYS @@ -153,11 +152,84 @@ encrypted file without a signature, decryption will fail as well.> Note: this behavior might change in the future. -=head1 VULNERABILITIES +=head1 ALTERNATIVE COMMANDLINES -Currently there are a couple of problems which are not -addressed. These are usually protocol problems, which are -not caused by pcp1. +You can save typing if you supply additional arguments to +pcp after commandline options. Such arguments are treated +as filenames or recipients, depending what options you already +specified. + +Here is a list of commandlines and their possible alternatives: + + ORIGINAL ALTERNATIVE DESCRIPTION + + pcp -e -I message -r Bob pcp -e -r Bob message use 'message' as inputfile. + pcp -e -I message Bob use 'Bob' as recipient, + multiple recipients supported. + + pcp -d -I crypted pcp -d crypted use 'crypted' as inputfile. + + pcp -g -I message pcp -g message use 'message' as inputfile. + + pcp -g -I msg -O sig pcp -g -I msg sig use 'sig' as outputfile. + + pcp -p -O key.pcp pcp -p key.pcp use 'key.pcp' as outputfile. + + pcp -p -O key.pcp -r Bob pcp -p -O key.pcp Bob use 'Bob' as recipient. + + pcp -s -O key.pcp pcp -s key.pcp use 'key.pcp' as outputfile. + + pcp -s -O key.pcp -r Bob pcp -s -O key.pcp Bob use 'Bob' as recipient. + + pcp -P -I alice.pcp pcp -P alice.pcp use 'alice.pcp' as inputfile. + + pcp -S -I alice.pcp pcp -S alice.pcp use 'alice.pcp' as inputfile. + + +=head1 ENVIRONMENT VARIABLES + +pcp respects the following environment variables: + +=over + +=item B + +Use an alternative vaultfile. The default is B<~/.pcpvault> and +can be overridden with the B<-V> commandline option. If PCP_VAULT +is set, this one will be used instead. + +=item B + +Enable debugging output, where supported. Same as B<-D>. + +=back + +=head1 EXIT STATUS + +Pcp may return one of several error codes if it encounters problems. + +=over + +=item 0 No problems occurred. + +=item 1 Generic error code. + +=back + +=head1 FILES + +=over + +=item B<~/.pcpvault> + +Default vault file where all keys are stored. + +=back + +=head1 EXPERIMENTAL STATUS + +Currently there are a couple of problems which are currently +unsolved or in the process to be solved. =over @@ -523,4 +595,5 @@ outlined above into account>. PCP tries to be fully compatible with PBP (https://github.com/stef/pbp). Encrypted files and signatures - at least their binary versions - should be exchangable. However, this is a work in progress and might not work under all circumstances. Also there's currently -no shared key format between pbp and pcp. +no shared key format between pbp and pcp. However, it is possible to export and +import pbp keys from/to pcp. diff --git a/man/footer.pod b/man/footer.pod index 8134a69..e38b47f 100644 --- a/man/footer.pod +++ b/man/footer.pod @@ -1,7 +1,7 @@ =head1 COPYRIGHT -Copyright (c) 2013 by T.Linden +Copyright (c) 2013-2014 by T.v.Dein =head1 ADDITIONAL COPYRIGHTS @@ -40,7 +40,7 @@ under the B as well. =head1 AUTHORS -I> +I> =head1 LICENSE diff --git a/man/pcp1.pod b/man/pcp1.pod index 4f65c52..c332488 100644 --- a/man/pcp1.pod +++ b/man/pcp1.pod @@ -11,6 +11,7 @@ Pretty Curved Privacy - File encryption using eliptic curve cryptography. [ --export-public | --export-secret | --import-public | --import-secret ] [ --encrypt | --decrypt ] [ --sign | --check-signature ] + [ arguments ] General Options: -h --help Print this help message. @@ -47,6 +48,11 @@ Pretty Curved Privacy - File encryption using eliptic curve cryptography. Encoding Options: -z --z85-encode Armor with Z85 encoding. + + Arguments: + Extra arguments after options are treated as filenames or + recipients, depending on operation mode. + =head1 OPTIONS Usage: pcp1 [options] @@ -235,7 +241,6 @@ Oh - and if you're wondering why I named them Alicia and Bobby: I was just sick of Alice and Bob. We're running NSA-free, so we're using other sample names as well. -# -*-perl-*- =head1 PCP1 KEYS @@ -390,11 +395,84 @@ encrypted file without a signature, decryption will fail as well.> Note: this behavior might change in the future. -=head1 VULNERABILITIES +=head1 ALTERNATIVE COMMANDLINES -Currently there are a couple of problems which are not -addressed. These are usually protocol problems, which are -not caused by pcp1. +You can save typing if you supply additional arguments to +pcp after commandline options. Such arguments are treated +as filenames or recipients, depending what options you already +specified. + +Here is a list of commandlines and their possible alternatives: + + ORIGINAL ALTERNATIVE DESCRIPTION + + pcp -e -I message -r Bob pcp -e -r Bob message use 'message' as inputfile. + pcp -e -I message Bob use 'Bob' as recipient, + multiple recipients supported. + + pcp -d -I crypted pcp -d crypted use 'crypted' as inputfile. + + pcp -g -I message pcp -g message use 'message' as inputfile. + + pcp -g -I msg -O sig pcp -g -I msg sig use 'sig' as outputfile. + + pcp -p -O key.pcp pcp -p key.pcp use 'key.pcp' as outputfile. + + pcp -p -O key.pcp -r Bob pcp -p -O key.pcp Bob use 'Bob' as recipient. + + pcp -s -O key.pcp pcp -s key.pcp use 'key.pcp' as outputfile. + + pcp -s -O key.pcp -r Bob pcp -s -O key.pcp Bob use 'Bob' as recipient. + + pcp -P -I alice.pcp pcp -P alice.pcp use 'alice.pcp' as inputfile. + + pcp -S -I alice.pcp pcp -S alice.pcp use 'alice.pcp' as inputfile. + + +=head1 ENVIRONMENT VARIABLES + +pcp respects the following environment variables: + +=over + +=item B + +Use an alternative vaultfile. The default is B<~/.pcpvault> and +can be overridden with the B<-V> commandline option. If PCP_VAULT +is set, this one will be used instead. + +=item B + +Enable debugging output, where supported. Same as B<-D>. + +=back + +=head1 EXIT STATUS + +Pcp may return one of several error codes if it encounters problems. + +=over + +=item 0 No problems occurred. + +=item 1 Generic error code. + +=back + +=head1 FILES + +=over + +=item B<~/.pcpvault> + +Default vault file where all keys are stored. + +=back + +=head1 EXPERIMENTAL STATUS + +Currently there are a couple of problems which are currently +unsolved or in the process to be solved. =over @@ -760,11 +838,12 @@ outlined above into account>. PCP tries to be fully compatible with PBP (https://github.com/stef/pbp). Encrypted files and signatures - at least their binary versions - should be exchangable. However, this is a work in progress and might not work under all circumstances. Also there's currently -no shared key format between pbp and pcp. +no shared key format between pbp and pcp. However, it is possible to export and +import pbp keys from/to pcp. =head1 COPYRIGHT -Copyright (c) 2013 by T.Linden +Copyright (c) 2013-2014 by T.v.Dein =head1 ADDITIONAL COPYRIGHTS @@ -803,7 +882,7 @@ under the B as well. =head1 AUTHORS -I> +I> =head1 LICENSE diff --git a/src/pcp.c b/src/pcp.c index 7008408..04dd714 100644 --- a/src/pcp.c +++ b/src/pcp.c @@ -54,6 +54,7 @@ int main (int argc, char **argv) { char *keyid = NULL; char *id = NULL; char *xpass = NULL; + char *extra = NULL; plist_t *recipient = NULL; FILE *in; @@ -263,6 +264,85 @@ int main (int argc, char **argv) { mode = PCP_MODE_ENCRYPT_ME; } + + if(argc >= 1) { + /* ok, there are arguments left on the commandline. + treat it as filename or recipient, depending on + current mode and other given parameters */ + extra = ucmalloc(strlen(argv[0])+1); + strncpy(extra, argv[0], strlen(argv[0])+1); + + switch (mode) { + case PCP_MODE_DECRYPT: + if(infile == NULL) + infile = extra; + break; + + case PCP_MODE_ENCRYPT: + if(infile == NULL) + infile = extra; + else if(userec == 0 && useid == 0) { + userec = 1; + int i; + for (i=0; i