aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Schulz <[email protected]>2002-01-03 19:47:20 +0000
committerTimo Schulz <[email protected]>2002-01-03 19:47:20 +0000
commitc02977a2de1fb590f0b49e6d75fad7440054213b (patch)
treeb958ec349178966a78607729a1e6b9593ea4e073
parentset filetype of Makefile correctly (diff)
downloadgnupg-c02977a2de1fb590f0b49e6d75fad7440054213b.tar.gz
gnupg-c02977a2de1fb590f0b49e6d75fad7440054213b.zip
New command (encrypt-files).
-rw-r--r--doc/DETAILS1
-rw-r--r--g10/ChangeLog12
-rw-r--r--g10/encode.c16
-rw-r--r--g10/g10.c8
-rw-r--r--g10/main.h2
-rw-r--r--g10/verify.c2
6 files changed, 40 insertions, 1 deletions
diff --git a/doc/DETAILS b/doc/DETAILS
index 430122ed5..a481c7b0c 100644
--- a/doc/DETAILS
+++ b/doc/DETAILS
@@ -221,6 +221,7 @@ more arguments in future versions.
Start processing a file <filename>. <what> indicates the performed
operation:
1 - verify
+ 2 - encrypt
FILE_DONE
Marks the end of a file processing which has been started
diff --git a/g10/ChangeLog b/g10/ChangeLog
index dd23b0a1b..ddfb61935 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,15 @@
+2002-01-03 Timo Schulz <[email protected]>
+
+ * g10.c: New command --encrypt-files.
+
+ * verify.c (print_file_status): Removed the static because
+ encode_crypt_files also uses this function.
+
+ * main.h (print_files_status): New.
+ (encode_crypt_files): New.
+
+ * encode.c (encode_crypt_files): New.
+
2002-01-02 Stefan Bellon <[email protected]>
* keyserver.c: Moved util.h include down in order to avoid
diff --git a/g10/encode.c b/g10/encode.c
index 901d0acae..7cacd9ef2 100644
--- a/g10/encode.c
+++ b/g10/encode.c
@@ -556,3 +556,19 @@ write_pubkey_enc_from_list( PK_LIST pk_list, DEK *dek, IOBUF out )
return 0;
}
+void
+encode_crypt_files(int argc, char **argv, STRLIST remusr)
+{
+ int rc = 0;
+
+ while (argc--) {
+ print_file_status(STATUS_FILE_START, *argv, 2);
+ if ( (rc = encode_crypt(*argv, remusr)) )
+ log_error("%s: encryption failed: %s\n", print_fname_stdin(*argv),
+ g10_errstr(rc) );
+ write_status( STATUS_FILE_DONE );
+ argv++;
+ }
+}
+
+ \ No newline at end of file
diff --git a/g10/g10.c b/g10/g10.c
index c3fbefbbc..14e743ed1 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -56,6 +56,7 @@ enum cmd_and_opt_values { aNull = 0,
aSym = 'c',
aDecrypt = 'd',
aEncr = 'e',
+ aEncrFiles,
oInteractive = 'i',
oKOption = 'k',
oDryRun = 'n',
@@ -265,6 +266,7 @@ static ARGPARSE_OPTS opts[] = {
{ aClearsign, "clearsign", 256, N_("|[file]|make a clear text signature") },
{ aDetachedSign, "detach-sign", 256, N_("make a detached signature")},
{ aEncr, "encrypt", 256, N_("encrypt data")},
+ { aEncrFiles, "encrypt-files", 256, N_("encrypt files")},
{ aSym, "symmetric", 256, N_("encryption only with symmetric cipher")},
{ aStore, "store", 256, N_("store only")},
{ aDecrypt, "decrypt", 256, N_("decrypt data (default)")},
@@ -894,6 +896,7 @@ main( int argc, char **argv )
case aDecrypt: set_cmd( &cmd, aDecrypt); break;
case aEncr: set_cmd( &cmd, aEncr); break;
+ case aEncrFiles: set_cmd( &cmd, aEncrFiles ); break;
case aSign: set_cmd( &cmd, aSign ); break;
case aKeygen: set_cmd( &cmd, aKeygen); greeting=1; break;
case aSignKey: set_cmd( &cmd, aSignKey); break;
@@ -1518,6 +1521,11 @@ main( int argc, char **argv )
log_error("%s: encryption failed: %s\n", print_fname_stdin(fname), g10_errstr(rc) );
break;
+ case aEncrFiles: /* encrypt the given files */
+ if (argc)
+ encode_crypt_files(argc, argv, remusr);
+ break;
+
case aSign: /* sign the given file */
sl = NULL;
if( detached_sig ) { /* sign all files */
diff --git a/g10/main.h b/g10/main.h
index 9d23bb992..772e1c432 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -76,6 +76,7 @@ void display_online_help( const char *keyword );
int encode_symmetric( const char *filename );
int encode_store( const char *filename );
int encode_crypt( const char *filename, STRLIST remusr );
+void encode_crypt_files(int argc, char **argv, STRLIST remusr);
int encrypt_filter( void *opaque, int control,
IOBUF a, byte *buf, size_t *ret_len);
@@ -163,6 +164,7 @@ void show_policy_url(PKT_signature *sig);
void show_notation(PKT_signature *sig);
/*-- verify.c --*/
+void print_file_status( int status, const char *name, int what );
int verify_signatures( int nfiles, char **files );
int verify_files( int nfiles, char **files );
diff --git a/g10/verify.c b/g10/verify.c
index 98ab5ceea..7ab20c140 100644
--- a/g10/verify.c
+++ b/g10/verify.c
@@ -115,7 +115,7 @@ verify_signatures( int nfiles, char **files )
}
-static void
+void
print_file_status( int status, const char *name, int what )
{
char *p = m_alloc(strlen(name)+10);