summaryrefslogtreecommitdiffstats
path: root/g10/plaintext.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1997-12-03 11:20:03 +0100
committerWerner Koch <wk@gnupg.org>1997-12-03 11:20:03 +0100
commit3b1b6f9d98b38480ba2074158fa640b881cdb97e (patch)
tree3da6ce59ca52217eac24a5ab31d061096a019013 /g10/plaintext.c
parentSicherung (diff)
downloadgnupg2-3b1b6f9d98b38480ba2074158fa640b881cdb97e.tar.xz
gnupg2-3b1b6f9d98b38480ba2074158fa640b881cdb97e.zip
detached signatures are working
Diffstat (limited to 'g10/plaintext.c')
-rw-r--r--g10/plaintext.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c
index d317fd789..edd12891c 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -82,6 +82,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx )
rc = G10ERR_READ_FILE;
goto leave;
}
+ if( mfx->md )
+ md_putchar(mfx->md, c );
if( mfx->rmd160 )
rmd160_putchar(mfx->rmd160, c );
if( mfx->md5 )
@@ -124,3 +126,42 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx )
return rc;
}
+
+/****************
+ * Ask for the detached datafile and calculate the digest from it.
+ */
+int
+ask_for_detached_datafile( md_filter_context_t *mfx )
+{
+ char *answer;
+ FILE *fp;
+ int rc = 0;
+ int c;
+
+ tty_printf("Detached signature.\n");
+ answer = tty_get("Please enter name of data file: ");
+ tty_kill_prompt();
+
+ fp = fopen(answer,"rb");
+ if( !fp ) {
+ log_error("can't open '%s': %s\n", answer, strerror(errno) );
+ rc = G10ERR_READ_FILE;
+ goto leave;
+ }
+
+ while( (c = getc(fp)) != EOF ) {
+ if( mfx->md )
+ md_putchar(mfx->md, c );
+ if( mfx->rmd160 )
+ rmd160_putchar(mfx->rmd160, c );
+ if( mfx->md5 )
+ md5_putchar(mfx->md5, c );
+ }
+ fclose(fp);
+
+ leave:
+ m_free(answer);
+ return rc;
+}
+
+