[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/certmanager/lib
From: Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date: 2004-10-19 19:22:22
Message-ID: 20041019192222.8636F16C60 () office ! kde ! org
[Download RAW message or body]
CVS commit by mutz:
From KDE_3_3_BRANCH: Detect wrong key usage (e.g. signing-only keys used for encryption)
M +15 -1 cryptplug.cpp 1.15
M +4 -4 cryptplug.h 1.6
M +3 -0 cryptplugwrapper.h 1.17
--- kdepim/certmanager/lib/cryptplug.cpp #1.14:1.15
@@ -1990,4 +1990,5 @@ bool CryptPlug::decryptAndCheckMessage(
gpgme_ctx_t ctx;
gpgme_error_t err;
+ gpgme_decrypt_result_t decryptresult;
gpgme_data_t gCiphertext, gPlaintext;
gpgme_sig_stat_t sigstatus = GPGME_SIG_STAT_NONE;
@@ -1995,4 +1996,5 @@ bool CryptPlug::decryptAndCheckMessage(
char* rCiph = 0;
bool bOk = false;
+ bool bWrongKeyUsage = false;
if( !ciphertext )
@@ -2019,4 +2021,11 @@ bool CryptPlug::decryptAndCheckMessage(
err = gpgme_op_decrypt_verify( ctx, gCiphertext, gPlaintext );
gpgme_data_release( gCiphertext );
+
+ decryptresult = gpgme_op_decrypt_result( ctx );
+#ifdef HAVE_GPGME_WRONG_KEY_USAGE
+ if( decryptresult->wrong_key_usage )
+ bWrongKeyUsage = true;
+#endif
+
if( err ) {
fprintf( stderr, "\ngpgme_op_decrypt_verify() returned this error code: %i\n\n", err );
@@ -2034,4 +2043,9 @@ bool CryptPlug::decryptAndCheckMessage(
}
+ if( bWrongKeyUsage ) {
+ if( errId )
+ *errId = CRYPTPLUG_ERR_WRONG_KEY_USAGE; // report the wrong key usage
+ }
+
rCiph = gpgme_data_release_and_get_mem( gPlaintext, &rCLen );
--- kdepim/certmanager/lib/cryptplug.h #1.5:1.6
@@ -413,5 +413,5 @@ const char* bugURL( void );
*/
int interfaceVersion (int *min_version);
-
+#define CRYPTPLUG_ERR_WRONG_KEY_USAGE 0x7070
/*! \ingroup groupGeneral
@@ -1127,7 +1127,7 @@ struct CertificateInfo {
};
-/*! \fn struct CertIterator* startListCertificates( const char* pattern );
- \fn struct CertificateInfo* nextCertificate( struct CertIterator* );
- \fn void endListCertificates( struct CertIterator* );
+/*! \function struct CertIterator* startListCertificates( const char* pattern );
+ \function struct CertificateInfo* nextCertificate( struct CertIterator* );
+ \function void endListCertificates( struct CertIterator* );
\ingroup certList
--- kdepim/certmanager/lib/cryptplugwrapper.h #1.16:1.17
@@ -535,4 +535,7 @@ public:
crypto actions.
+ \param parent The parent widget to be used for displaying dialogs.
+ If this parameter is NULL the desktop is used as
+ the dialogs' parent widget.
\param name The external name that is visible in lists, messages,
etc.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic