diff options
author | Werner Koch <[email protected]> | 1998-03-09 21:44:06 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1998-03-09 21:44:06 +0000 |
commit | a6a8f1e706bd7e528262151bc04ebb9409c2eeed (patch) | |
tree | 20b5771581e695a22559d8ffe3f90862afb11e3d /g10/decrypt.c | |
parent | removed g10maint.c (diff) | |
download | gnupg-a6a8f1e706bd7e528262151bc04ebb9409c2eeed.tar.gz gnupg-a6a8f1e706bd7e528262151bc04ebb9409c2eeed.zip |
partial DSA support
Diffstat (limited to 'g10/decrypt.c')
-rw-r--r-- | g10/decrypt.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/g10/decrypt.c b/g10/decrypt.c new file mode 100644 index 000000000..1a457f2df --- /dev/null +++ b/g10/decrypt.c @@ -0,0 +1,82 @@ +/* verify.c - verify signed data + * Copyright (C) 1998 Free Software Foundation, Inc. + * + * This file is part of GNUPG. + * + * GNUPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <assert.h> + +#include "options.h" +#include "packet.h" +#include "errors.h" +#include "iobuf.h" +#include "keydb.h" +#include "memory.h" +#include "util.h" +#include "main.h" +#include "i18n.h" + + + +/**************** + * Assume that the input is an encrypted message and decrypt + * (and if signed, verify the signature) it. + * This command differs from the default operation, as it never + * write to the filename which is included in the file and that it + * rejects files which don't begin with an encrypted message. + */ + +int +decrypt_message( const char *filename ) +{ + IOBUF fp; + armor_filter_context_t afx; + int rc; + int no_out=0; + + /* open the message file */ + fp = iobuf_open(filename); + if( !fp ) { + log_error(_("can't open '%s'\n"), print_fname_stdin(filename)); + return G10ERR_OPEN_FILE; + } + + if( !opt.no_armor ) { + if( use_armor_filter( fp ) ) { + memset( &afx, 0, sizeof afx); + iobuf_push_filter( fp, armor_filter, &afx ); + } + } + + if( !opt.outfile ) { + no_out = 1; + opt.outfile = "-"; + } + rc = proc_encryption_packets( fp ); + if( no_out ) + opt.outfile = NULL; + iobuf_close(fp); + return rc; +} + + + |