aboutsummaryrefslogtreecommitdiffstats
path: root/gpgmeplug/gpgmeplug.c
diff options
context:
space:
mode:
authorKarl-Heinz Zimmer <[email protected]>2001-11-25 15:23:21 +0000
committerKarl-Heinz Zimmer <[email protected]>2001-11-25 15:23:21 +0000
commit9e24b664755cc9b0b54802e31ef39531c63aca31 (patch)
treecb0f74092395973c6f6eb2ba7cfddf4dd70265e8 /gpgmeplug/gpgmeplug.c
parentNow gpgmeplug.c can also create encrypted and signed+encrypted S/MIME mails. (diff)
downloadgpgme-9e24b664755cc9b0b54802e31ef39531c63aca31.tar.gz
gpgme-9e24b664755cc9b0b54802e31ef39531c63aca31.zip
[Kalle] signature verification and decoding of encrypted mails
Diffstat (limited to '')
-rw-r--r--gpgmeplug/gpgmeplug.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/gpgmeplug/gpgmeplug.c b/gpgmeplug/gpgmeplug.c
index 3fe308b2..8be1948e 100644
--- a/gpgmeplug/gpgmeplug.c
+++ b/gpgmeplug/gpgmeplug.c
@@ -773,8 +773,30 @@ bool signMessage( const char* cleartext,
return bOk;
}
-bool checkMessageSignature( const char* ciphertext, const char**
- cleartext, struct SignatureMetaData* sigmeta ){ return true; }
+
+bool checkMessageSignature( const char* ciphertext,
+ const char* signaturetext,
+ struct SignatureMetaData* sigmeta )
+{
+ GpgmeCtx ctx;
+ GpgmeSigStat status;
+ GpgmeData datapart, sigpart;
+
+ gpgme_new( &ctx );
+ gpgme_data_new_from_mem( &datapart, ciphertext,
+ 1+strlen( ciphertext ), 1 );
+ gpgme_data_new_from_mem( &sigpart, signaturetext,
+ 1+strlen( signaturetext ), 1 );
+
+ gpgme_op_verify( ctx, sigpart, datapart, &status );
+ gpgme_data_release( datapart );
+ gpgme_data_release( sigpart );
+ gpgme_release( ctx );
+
+ // PENDING(khz) Differentiate better between various failures
+ // PENDING(khz) Fill sigmeta
+ return ( status == GPGME_SIG_STAT_GOOD );
+}
bool storeCertificatesFromMessage(
const char* ciphertext ){ return true; }