1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

IDEA removed, signing works

This commit is contained in:
Werner Koch 1997-11-24 11:04:11 +00:00
parent db19a27518
commit a51cca90b6
30 changed files with 428 additions and 654 deletions

View file

@ -29,7 +29,7 @@
#include "util.h"
#include "cipher.h"
#include "keydb.h"
#include "filter.h"
static int opt_list=1; /* and list the data packets to stdout */
@ -48,7 +48,9 @@ proc_packets( IOBUF a )
int lvl0, lvl1;
int last_was_pubkey_enc = 0;
u32 keyid[2];
md_filter_context_t mfx;
memset( &mfx, 0, sizeof mfx );
lvl0 = opt.check_sigs? 1:0; /* stdout or /dev/null */
lvl1 = opt.check_sigs? 1:3; /* stdout or error */
pkt = m_alloc( sizeof *pkt );
@ -135,7 +137,14 @@ proc_packets( IOBUF a )
sig = pkt->pkt.signature;
ustr = get_user_id_string(sig->keyid);
result = -1;
if( sig->sig_class != 0x10 )
if( sig->sig_class == 0x00 ) {
if( mfx.rmd160 )
result = 0;
else
printstr(lvl1,"sig?: %s: no plaintext for signature\n",
ustr);
}
else if( sig->sig_class != 0x10 )
printstr(lvl1,"sig?: %s: unknown signature class %02x\n",
ustr, sig->sig_class);
else if( !pkt->pkc_parent || !pkt->user_parent )
@ -145,20 +154,25 @@ proc_packets( IOBUF a )
if( result )
;
else if( !opt.check_sigs ) {
else if( !opt.check_sigs && sig->sig_class != 0x00 ) {
result = -1;
printstr(lvl0, "sig: from %s\n", ustr );
}
else if(sig->pubkey_algo == PUBKEY_ALGO_RSA ) {
md_handle.algo = sig->d.rsa.digest_algo;
if( sig->d.rsa.digest_algo == DIGEST_ALGO_RMD160 ) {
md_handle.u.rmd = rmd160_copy(pkt->pkc_parent->mfx.rmd160);
rmd160_write(md_handle.u.rmd, pkt->user_parent->name,
pkt->user_parent->len);
if( sig->sig_class == 0x00 )
md_handle.u.rmd = rmd160_copy( mfx.rmd160 );
else {
md_handle.u.rmd = rmd160_copy(pkt->pkc_parent->mfx.rmd160);
rmd160_write(md_handle.u.rmd, pkt->user_parent->name,
pkt->user_parent->len);
}
result = signature_check( sig, md_handle );
rmd160_close(md_handle.u.rmd);
}
else if( sig->d.rsa.digest_algo == DIGEST_ALGO_MD5 ) {
else if( sig->d.rsa.digest_algo == DIGEST_ALGO_MD5
&& sig->sig_class != 0x00 ) {
md_handle.u.md5 = md5_copy(pkt->pkc_parent->mfx.md5);
md5_write(md_handle.u.md5, pkt->user_parent->name,
pkt->user_parent->len);
@ -173,6 +187,8 @@ proc_packets( IOBUF a )
if( result == -1 )
;
else if( !result && sig->sig_class == 0x00 )
printstr(1, "sig: good signature from %s\n", ustr );
else if( !result )
printstr(lvl0, "sig: good signature from %s\n", ustr );
else
@ -235,7 +251,9 @@ proc_packets( IOBUF a )
else if( pkt->pkttype == PKT_PLAINTEXT ) {
PKT_plaintext *pt = pkt->pkt.plaintext;
printf("txt: plain text data name='%.*s'\n", pt->namelen, pt->name);
result = handle_plaintext( pt );
free_md_filter_context( &mfx );
mfx.rmd160 = rmd160_open(0);
result = handle_plaintext( pt, &mfx );
if( !result )
fputs( " okay",stdout);
else
@ -269,6 +287,7 @@ proc_packets( IOBUF a )
m_free(dek);
free_packet( pkt );
m_free( pkt );
free_md_filter_context( &mfx );
return 0;
}