1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

New command (encrypt-files).

This commit is contained in:
Timo Schulz 2002-01-03 19:47:20 +00:00
parent 4573513a34
commit c02977a2de
6 changed files with 40 additions and 1 deletions

View File

@ -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

View File

@ -1,3 +1,15 @@
2002-01-03 Timo Schulz <ts@winpt.org>
* 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 <sbellon@sbellon.de>
* keyserver.c: Moved util.h include down in order to avoid

View File

@ -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++;
}
}

View File

@ -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 */

View File

@ -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 );

View File

@ -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);