From 56d6e0e38ee138223368f39ee11502e0e582d8d5 Mon Sep 17 00:00:00 2001 From: Karl-Heinz Zimmer Date: Tue, 5 Mar 2002 21:23:58 +0000 Subject: [PATCH] Changed interface: additionally we now pass the following parameters into the checkMessageSignature function: bool signatureIsBinary - telling us whether the signature is armored ASCII or binary data, int signatureLen - holding the TRUE length of the signature if (and only if) this is binary data --- trunk/gpgmeplug/cryptplug.h | 4 +++- trunk/gpgmeplug/gpgmeplug.c | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/trunk/gpgmeplug/cryptplug.h b/trunk/gpgmeplug/cryptplug.h index 9cdeb07..1b1aead 100644 --- a/trunk/gpgmeplug/cryptplug.h +++ b/trunk/gpgmeplug/cryptplug.h @@ -427,7 +427,7 @@ SignEmail signEmail( void ); */ void setWarnSendUnsigned( bool ); - + /*! \ingroup groupConfigSign \brief Returns whether a warning should be emitted when the user tries to send an email message unsigned. @@ -1427,6 +1427,8 @@ struct SignatureMetaData { */ bool checkMessageSignature( const char* ciphertext, const char* signaturetext, + bool signatureIsBinary, + int signatureLen, struct SignatureMetaData* sigmeta ); /*! \ingroup groupSignAct diff --git a/trunk/gpgmeplug/gpgmeplug.c b/trunk/gpgmeplug/gpgmeplug.c index 0de5d49..d9d8ea1 100644 --- a/trunk/gpgmeplug/gpgmeplug.c +++ b/trunk/gpgmeplug/gpgmeplug.c @@ -865,7 +865,7 @@ bool signMessage( const char* cleartext, break; } gpgme_set_include_certs (ctx, sendCerts); - + // PENDING(g10) Implement this //gpgme_set_signature_algorithm( ctx, config.signatureAlgorithm ); @@ -973,6 +973,8 @@ sig_status_to_string( GpgmeSigStat status ) bool checkMessageSignature( const char* ciphertext, const char* signaturetext, + bool signatureIsBinary, + int signatureLen, struct SignatureMetaData* sigmeta ) { GpgmeCtx ctx; @@ -987,10 +989,18 @@ bool checkMessageSignature( const char* ciphertext, gpgme_new( &ctx ); gpgme_set_protocol (ctx, GPGMEPLUG_PROTOCOL); + gpgme_set_armor (ctx, signatureIsBinary ? 0 : 1); +// gpgme_set_textmode (ctx, signatureIsBinary ? 0 : 1); + gpgme_data_new_from_mem( &datapart, ciphertext, 1+strlen( ciphertext ), 1 ); - gpgme_data_new_from_mem( &sigpart, signaturetext, - 1+strlen( signaturetext ), 1 ); + + gpgme_data_new_from_mem( &sigpart, + signaturetext, + signatureIsBinary + ? signatureLen + : (1+strlen( signaturetext )), + 1 ); gpgme_op_verify( ctx, sigpart, datapart, &status ); gpgme_data_release( datapart ); -- 2.26.2