mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
New command --decrypt-files.
Some fixes.
This commit is contained in:
parent
b3a5994235
commit
e17cd91abe
@ -222,6 +222,7 @@ more arguments in future versions.
|
||||
operation:
|
||||
1 - verify
|
||||
2 - encrypt
|
||||
3 - decrypt
|
||||
|
||||
FILE_DONE
|
||||
Marks the end of a file processing which has been started
|
||||
|
@ -1,3 +1,11 @@
|
||||
2002-01-15 Timo Schulz <ts@winpt.org>
|
||||
|
||||
* encode.c (encode_crypt_files): Fail if --output is used.
|
||||
|
||||
* g10.c: New command --decrypt-files.
|
||||
|
||||
* decrypt.c (decrypt_messages): New.
|
||||
|
||||
2002-01-09 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* g10.c, misc.c, gpgv.c: move idea_cipher_warn to misc.c so gpgv.c
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "memory.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
#include "status.h"
|
||||
#include "i18n.h"
|
||||
|
||||
|
||||
@ -78,5 +79,59 @@ decrypt_message( const char *filename )
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
decrypt_messages(int nfiles, char **files)
|
||||
{
|
||||
IOBUF fp;
|
||||
armor_filter_context_t afx;
|
||||
char *p, *output = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (opt.outfile)
|
||||
{
|
||||
log_error(_("--output doesn't work for this command\n"));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
while (nfiles--)
|
||||
{
|
||||
print_file_status(STATUS_FILE_START, *files, 3);
|
||||
output = make_outfile_name(*files);
|
||||
if (!output)
|
||||
continue;
|
||||
fp = iobuf_open(*files);
|
||||
if (!fp)
|
||||
{
|
||||
log_error(_("can't open `%s'\n"), print_fname_stdin(*files));
|
||||
continue;
|
||||
}
|
||||
if (!opt.no_armor)
|
||||
{
|
||||
if (use_armor_filter(fp))
|
||||
{
|
||||
memset(&afx, 0, sizeof afx);
|
||||
iobuf_push_filter(fp, armor_filter, &afx);
|
||||
}
|
||||
}
|
||||
rc = proc_packets(NULL, fp);
|
||||
iobuf_close(fp);
|
||||
if (rc)
|
||||
log_error("%s: decryption failed: %s\n", print_fname_stdin(*files),
|
||||
g10_errstr(rc));
|
||||
p = get_last_passphrase();
|
||||
set_next_passphrase(p);
|
||||
files++;
|
||||
m_free(output);
|
||||
write_status( STATUS_FILE_DONE );
|
||||
}
|
||||
set_next_passphrase(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -572,9 +572,8 @@ encode_crypt_files(int nfiles, char **files, STRLIST remusr)
|
||||
|
||||
if (opt.outfile)
|
||||
{
|
||||
if (opt.verbose)
|
||||
log_info(_("ignore --output for multiple files"));
|
||||
opt.outfile = NULL;
|
||||
log_error(_("--output doesn't work for this command\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nfiles)
|
||||
|
@ -72,6 +72,7 @@ enum cmd_and_opt_values { aNull = 0,
|
||||
oShowNotation,
|
||||
oNoShowNotation,
|
||||
oBatch = 500,
|
||||
aDecryptFiles,
|
||||
aClearsign,
|
||||
aStore,
|
||||
aKeygen,
|
||||
@ -273,6 +274,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||
{ aSym, "symmetric", 256, N_("encryption only with symmetric cipher")},
|
||||
{ aStore, "store", 256, N_("store only")},
|
||||
{ aDecrypt, "decrypt", 256, N_("decrypt data (default)")},
|
||||
{ aDecryptFiles, "decrypt-files", 256, N_("|[files]|decrypt files")},
|
||||
{ aVerify, "verify" , 256, N_("verify a signature")},
|
||||
{ aVerifyFiles, "verify-files" , 256, "@" },
|
||||
{ aListKeys, "list-keys", 256, N_("list keys")},
|
||||
@ -900,6 +902,7 @@ main( int argc, char **argv )
|
||||
case aSym: set_cmd( &cmd, aSym); break;
|
||||
|
||||
case aDecrypt: set_cmd( &cmd, aDecrypt); break;
|
||||
case aDecryptFiles: set_cmd( &cmd, aDecryptFiles); break;
|
||||
|
||||
case aEncr: set_cmd( &cmd, aEncr); break;
|
||||
case aEncrFiles: set_cmd( &cmd, aEncrFiles ); break;
|
||||
@ -1611,6 +1614,9 @@ main( int argc, char **argv )
|
||||
log_error("decrypt_message failed: %s\n", g10_errstr(rc) );
|
||||
break;
|
||||
|
||||
case aDecryptFiles:
|
||||
decrypt_messages(argc, argv);
|
||||
break;
|
||||
|
||||
case aSignKey: /* sign the key given as argument */
|
||||
if( argc != 1 )
|
||||
|
@ -169,6 +169,7 @@ int verify_files( int nfiles, char **files );
|
||||
|
||||
/*-- decrypt.c --*/
|
||||
int decrypt_message( const char *filename );
|
||||
void decrypt_messages(int nfiles, char **files);
|
||||
|
||||
/*-- plaintext.c --*/
|
||||
int hash_datafiles( MD_HANDLE md, MD_HANDLE md2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user