Add Plugin configuration option to allow for sending of *opaque* signed messages. Unfortunately this is necessary for communication with some MS Outlook clients, e.g. TrustedMime is not able to understand Multipart/Signed messages. <sigh> NOTE: This breaks compabilitity with kdenetwork, so make sure to update the KDE sources as well...
This commit is contained in:
parent
14f16305b0
commit
e7dc765826
@ -194,7 +194,15 @@ typedef enum {
|
|||||||
PinRequest_AfterMinutes = 5
|
PinRequest_AfterMinutes = 5
|
||||||
} PinRequests;
|
} PinRequests;
|
||||||
|
|
||||||
/* dummy values: */
|
|
||||||
|
typedef enum {
|
||||||
|
SignatureCompoundMode_undef = 0,
|
||||||
|
|
||||||
|
SignatureCompoundMode_Opaque = 1,
|
||||||
|
SignatureCompoundMode_Detached = 2
|
||||||
|
} SignatureCompoundMode;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SendCert_undef = 0,
|
SendCert_undef = 0,
|
||||||
|
|
||||||
@ -204,7 +212,7 @@ typedef enum {
|
|||||||
SendCert_SendChainWithRoot = 4
|
SendCert_SendChainWithRoot = 4
|
||||||
} SendCertificates;
|
} SendCertificates;
|
||||||
|
|
||||||
/* dummy values: */
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SignAlg_undef = 0,
|
SignAlg_undef = 0,
|
||||||
|
|
||||||
@ -406,6 +414,20 @@ void setSignatureAlgorithm( SignatureAlgorithm );
|
|||||||
\brief Returns the algorithm used for signing.
|
\brief Returns the algorithm used for signing.
|
||||||
*/
|
*/
|
||||||
SignatureAlgorithm signatureAlgorithm( void );
|
SignatureAlgorithm signatureAlgorithm( void );
|
||||||
|
|
||||||
|
/*! \ingroup groupConfigSign
|
||||||
|
\brief Sets whether signatures and signed data should be send
|
||||||
|
as opaque signed or
|
||||||
|
as multipart/signed message parts.
|
||||||
|
*/
|
||||||
|
void setSignatureCompoundMode( SignatureCompoundMode );
|
||||||
|
|
||||||
|
/*! \ingroup groupConfigSign
|
||||||
|
\brief Returns whether signatures and signed data will be send
|
||||||
|
as opaque signed or
|
||||||
|
as multipart/signed message parts.
|
||||||
|
*/
|
||||||
|
SignatureCompoundMode signatureCompoundMode( void );
|
||||||
|
|
||||||
/*! \ingroup groupConfigSign
|
/*! \ingroup groupConfigSign
|
||||||
\brief Sets which certificates should be sent with the
|
\brief Sets which certificates should be sent with the
|
||||||
|
@ -1,23 +1,44 @@
|
|||||||
#define GPGMEPLUG_PROTOCOL GPGME_PROTOCOL_OpenPGP
|
#define GPGMEPLUG_PROTOCOL GPGME_PROTOCOL_OpenPGP
|
||||||
|
|
||||||
#define GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT true
|
/* definitions for signing */
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MIME_OBJECT true
|
// 1. opaque signatures (only used for S/MIME)
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MULTI_MIME true
|
#define GPGMEPLUG_OPA_SIGN_INCLUDE_CLEARTEXT false
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_MAIN "multipart/signed;protocol=\"application/pgp-signature\";micalg=pgp-sha1"
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MIME_OBJECT false
|
||||||
#define GPGMEPLUG_SIGN_CDISP_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MULTI_MIME false
|
||||||
#define GPGMEPLUG_SIGN_CTENC_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_BTEXT_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_CODE "application/pgp-signature"
|
#define GPGMEPLUG_OPA_SIGN_CTENC_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_CODE ""
|
#define GPGMEPLUG_OPA_SIGN_BTEXT_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_CODE ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_PREFIX ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_SEPARATOR ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_POSTFIX ""
|
#define GPGMEPLUG_OPA_SIGN_FLAT_PREFIX ""
|
||||||
|
#define GPGMEPLUG_OPA_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_OPA_SIGN_FLAT_POSTFIX ""
|
||||||
|
// 2. detached signatures (used for S/MIME and for OpenPGP)
|
||||||
|
#define GPGMEPLUG_DET_SIGN_INCLUDE_CLEARTEXT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MIME_OBJECT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MULTI_MIME true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_MAIN "multipart/signed;protocol=application/pgp-signature;micalg=pgp-sha1"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_BTEXT_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_CODE "application/pgp-signature"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_CODE ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_CODE ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_PREFIX ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_POSTFIX ""
|
||||||
|
// 3. common definitions for opaque and detached signing
|
||||||
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY false
|
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY false
|
||||||
|
|
||||||
|
/* definitions for encoding */
|
||||||
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
||||||
#define GPGMEPLUG_ENC_MAKE_MIME_OBJECT true
|
#define GPGMEPLUG_ENC_MAKE_MIME_OBJECT true
|
||||||
#define GPGMEPLUG_ENC_MAKE_MULTI_MIME true
|
#define GPGMEPLUG_ENC_MAKE_MULTI_MIME true
|
||||||
|
@ -1,23 +1,44 @@
|
|||||||
#define GPGMEPLUG_PROTOCOL GPGME_PROTOCOL_CMS
|
#define GPGMEPLUG_PROTOCOL GPGME_PROTOCOL_CMS
|
||||||
|
|
||||||
#define GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT true
|
/* definitions for signing */
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MIME_OBJECT true
|
// 1. opaque signatures (only used for S/MIME)
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MULTI_MIME true
|
#define GPGMEPLUG_OPA_SIGN_INCLUDE_CLEARTEXT false
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_MAIN "multipart/signed; protocol=\"application/pkcs7-signature\"; micalg=sha1"
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MIME_OBJECT true
|
||||||
#define GPGMEPLUG_SIGN_CDISP_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MULTI_MIME false
|
||||||
#define GPGMEPLUG_SIGN_CTENC_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_MAIN "application/pkcs7-mime; smime-type=signed-data; name=\"smime.p7m\""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_MAIN "attachment; filename=\"smime.p7m\""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_MAIN "base64"
|
||||||
#define GPGMEPLUG_SIGN_CTENC_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_BTEXT_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_CODE "application/pkcs7-signature; name=\"smime.p7s\""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_CODE "attachment; filename=\"smime.p7s\""
|
#define GPGMEPLUG_OPA_SIGN_BTEXT_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_CODE "base64"
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_PREFIX ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_SEPARATOR ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_POSTFIX ""
|
#define GPGMEPLUG_OPA_SIGN_FLAT_PREFIX ""
|
||||||
|
#define GPGMEPLUG_OPA_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_OPA_SIGN_FLAT_POSTFIX ""
|
||||||
|
// 2. detached signatures (used for S/MIME and for OpenPGP)
|
||||||
|
#define GPGMEPLUG_DET_SIGN_INCLUDE_CLEARTEXT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MIME_OBJECT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MULTI_MIME true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_MAIN "multipart/signed; protocol=\"application/pkcs7-signature\"; micalg=sha1"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_BTEXT_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_CODE "application/pkcs7-signature; name=\"smime.p7s\""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_CODE "attachment; filename=\"smime.p7s\""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_CODE "base64"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_PREFIX ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_POSTFIX ""
|
||||||
|
// 3. common definitions for opaque and detached signing
|
||||||
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY true
|
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY true
|
||||||
|
|
||||||
|
/* definitions for encoding */
|
||||||
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
||||||
#define GPGMEPLUG_ENC_MAKE_MIME_OBJECT true
|
#define GPGMEPLUG_ENC_MAKE_MIME_OBJECT true
|
||||||
#define GPGMEPLUG_ENC_MAKE_MULTI_MIME false
|
#define GPGMEPLUG_ENC_MAKE_MULTI_MIME false
|
||||||
|
@ -62,26 +62,51 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* definitions for signing */
|
/* definitions for signing */
|
||||||
#ifndef GPGMEPLUG_SIGN_MAKE_MIME_OBJECT
|
// 1. opaque signatures (only used for S/MIME)
|
||||||
#define GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT true
|
#ifndef GPGMEPLUG_OPA_SIGN_MAKE_MIME_OBJECT
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MIME_OBJECT true
|
#define GPGMEPLUG_OPA_SIGN_INCLUDE_CLEARTEXT false
|
||||||
#define GPGMEPLUG_SIGN_MAKE_MULTI_MIME true
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MIME_OBJECT false
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_MAIN "multipart/signed;protocol=application/pgp-signature;micalg=pgp-sha1"
|
#define GPGMEPLUG_OPA_SIGN_MAKE_MULTI_MIME false
|
||||||
#define GPGMEPLUG_SIGN_CDISP_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_MAIN ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_MAIN ""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_BTEXT_VERSION ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CTYPE_CODE "application/pgp-signature"
|
#define GPGMEPLUG_OPA_SIGN_BTEXT_VERSION ""
|
||||||
#define GPGMEPLUG_SIGN_CDISP_CODE ""
|
#define GPGMEPLUG_OPA_SIGN_CTYPE_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_CTENC_CODE ""
|
#define GPGMEPLUG_OPA_SIGN_CDISP_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_PREFIX ""
|
#define GPGMEPLUG_OPA_SIGN_CTENC_CODE ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_SEPARATOR ""
|
#define GPGMEPLUG_OPA_SIGN_FLAT_PREFIX ""
|
||||||
#define GPGMEPLUG_SIGN_FLAT_POSTFIX ""
|
#define GPGMEPLUG_OPA_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_OPA_SIGN_FLAT_POSTFIX ""
|
||||||
|
#endif
|
||||||
|
// 2. detached signatures (used for S/MIME and for OpenPGP)
|
||||||
|
#ifndef GPGMEPLUG_DET_SIGN_MAKE_MIME_OBJECT
|
||||||
|
#define GPGMEPLUG_DET_SIGN_INCLUDE_CLEARTEXT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MIME_OBJECT true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_MAKE_MULTI_MIME true
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_MAIN "multipart/signed;protocol=application/pgp-signature;micalg=pgp-sha1"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_MAIN ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_BTEXT_VERSION ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTYPE_CODE "application/pgp-signature"
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CDISP_CODE ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_CTENC_CODE ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_PREFIX ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_SEPARATOR ""
|
||||||
|
#define GPGMEPLUG_DET_SIGN_FLAT_POSTFIX ""
|
||||||
|
#endif
|
||||||
|
// 3. common definitions for opaque and detached signing
|
||||||
|
#ifndef __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY
|
||||||
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY false
|
#define __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __GPGMEPLUG_ERROR_CLEARTEXT_IS_ZERO "Error: Cannot run checkMessageSignature() with cleartext == 0"
|
#define __GPGMEPLUG_ERROR_CLEARTEXT_IS_ZERO "Error: Cannot run checkMessageSignature() with cleartext == 0"
|
||||||
|
|
||||||
/* definitions for encoding */
|
/* definitions for encoding */
|
||||||
#ifndef GPGMEPLUG_ENC_MAKE_MIME_OBJECT
|
#ifndef GPGMEPLUG_ENC_MAKE_MIME_OBJECT
|
||||||
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
#define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT false
|
||||||
@ -133,6 +158,7 @@ typedef struct {
|
|||||||
const char* bugURL;
|
const char* bugURL;
|
||||||
const char* signatureKeyCertificate;
|
const char* signatureKeyCertificate;
|
||||||
SignatureAlgorithm signatureAlgorithm;
|
SignatureAlgorithm signatureAlgorithm;
|
||||||
|
SignatureCompoundMode signatureCompoundMode;
|
||||||
SendCertificates sendCertificates;
|
SendCertificates sendCertificates;
|
||||||
SignEmail signEmail;
|
SignEmail signEmail;
|
||||||
bool saveSentSignatures;
|
bool saveSentSignatures;
|
||||||
@ -180,6 +206,10 @@ bool initialize()
|
|||||||
config.signatureKeyCertificate = malloc( 1 );
|
config.signatureKeyCertificate = malloc( 1 );
|
||||||
strcpy( (char* )config.signatureKeyCertificate, "" );
|
strcpy( (char* )config.signatureKeyCertificate, "" );
|
||||||
config.signatureAlgorithm = SignAlg_SHA1;
|
config.signatureAlgorithm = SignAlg_SHA1;
|
||||||
|
if( GPGMEPLUG_PROTOCOL == GPGME_PROTOCOL_CMS )
|
||||||
|
config.signatureCompoundMode = SignatureCompoundMode_Opaque;
|
||||||
|
else
|
||||||
|
config.signatureCompoundMode = SignatureCompoundMode_Detached;
|
||||||
config.sendCertificates = SendCert_SendChainWithRoot;
|
config.sendCertificates = SendCert_SendChainWithRoot;
|
||||||
config.signEmail = SignEmail_SignAll;
|
config.signEmail = SignEmail_SignAll;
|
||||||
config.saveSentSignatures = true;
|
config.saveSentSignatures = true;
|
||||||
@ -301,6 +331,16 @@ SignatureAlgorithm signatureAlgorithm()
|
|||||||
return config.signatureAlgorithm;
|
return config.signatureAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSignatureCompoundMode( SignatureCompoundMode signComp )
|
||||||
|
{
|
||||||
|
config.signatureCompoundMode = signComp;
|
||||||
|
}
|
||||||
|
|
||||||
|
SignatureCompoundMode signatureCompoundMode()
|
||||||
|
{
|
||||||
|
return config.signatureCompoundMode;
|
||||||
|
}
|
||||||
|
|
||||||
void setSendCertificates( SendCertificates sendCert )
|
void setSendCertificates( SendCertificates sendCert )
|
||||||
{
|
{
|
||||||
config.sendCertificates = sendCert;
|
config.sendCertificates = sendCert;
|
||||||
@ -893,6 +933,7 @@ bool signMessage( const char* cleartext,
|
|||||||
int* errId,
|
int* errId,
|
||||||
char** errTxt )
|
char** errTxt )
|
||||||
{
|
{
|
||||||
|
bool bIsOpaque;
|
||||||
GpgmeCtx ctx;
|
GpgmeCtx ctx;
|
||||||
GpgmeError err;
|
GpgmeError err;
|
||||||
GpgmeKey rKey;
|
GpgmeKey rKey;
|
||||||
@ -958,7 +999,20 @@ bool signMessage( const char* cleartext,
|
|||||||
gpgme_data_new_from_mem (&data, cleartext,
|
gpgme_data_new_from_mem (&data, cleartext,
|
||||||
strlen( cleartext ), 1 );
|
strlen( cleartext ), 1 );
|
||||||
gpgme_data_new ( &sig );
|
gpgme_data_new ( &sig );
|
||||||
err = gpgme_op_sign (ctx, data, sig, GPGME_SIG_MODE_DETACH );
|
|
||||||
|
// NOTE: Currently we support Opaque signed messages only for S/MIME,
|
||||||
|
// but not for OpenPGP mode!
|
||||||
|
if( GPGMEPLUG_PROTOCOL == GPGME_PROTOCOL_CMS )
|
||||||
|
bIsOpaque = (SignatureCompoundMode_Opaque == signatureCompoundMode());
|
||||||
|
else
|
||||||
|
bIsOpaque = false;
|
||||||
|
|
||||||
|
err = gpgme_op_sign ( ctx,
|
||||||
|
data,
|
||||||
|
sig,
|
||||||
|
bIsOpaque
|
||||||
|
? GPGME_SIG_MODE_NORMAL
|
||||||
|
: GPGME_SIG_MODE_DETACH );
|
||||||
|
|
||||||
if ( err == GPGME_No_Error ) {
|
if ( err == GPGME_No_Error ) {
|
||||||
if( __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY ) {
|
if( __GPGMEPLUG_SIGNATURE_CODE_IS_BINARY ) {
|
||||||
@ -1005,39 +1059,76 @@ err = 0;
|
|||||||
gpgme_release (ctx);
|
gpgme_release (ctx);
|
||||||
|
|
||||||
if( bOk && structuring ) {
|
if( bOk && structuring ) {
|
||||||
structuring->includeCleartext = GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT;
|
if( bIsOpaque ) {
|
||||||
structuring->makeMimeObject = GPGMEPLUG_SIGN_MAKE_MIME_OBJECT;
|
structuring->includeCleartext = GPGMEPLUG_OPA_SIGN_INCLUDE_CLEARTEXT;
|
||||||
if( structuring->makeMimeObject ) {
|
structuring->makeMimeObject = GPGMEPLUG_OPA_SIGN_MAKE_MIME_OBJECT;
|
||||||
structuring->makeMultiMime = GPGMEPLUG_SIGN_MAKE_MULTI_MIME;
|
if( structuring->makeMimeObject ) {
|
||||||
storeNewCharPtr( &structuring->contentTypeMain,
|
structuring->makeMultiMime = GPGMEPLUG_OPA_SIGN_MAKE_MULTI_MIME;
|
||||||
GPGMEPLUG_SIGN_CTYPE_MAIN );
|
storeNewCharPtr( &structuring->contentTypeMain,
|
||||||
storeNewCharPtr( &structuring->contentDispMain,
|
GPGMEPLUG_OPA_SIGN_CTYPE_MAIN );
|
||||||
GPGMEPLUG_SIGN_CDISP_MAIN );
|
storeNewCharPtr( &structuring->contentDispMain,
|
||||||
storeNewCharPtr( &structuring->contentTEncMain,
|
GPGMEPLUG_OPA_SIGN_CDISP_MAIN );
|
||||||
GPGMEPLUG_SIGN_CTENC_MAIN );
|
storeNewCharPtr( &structuring->contentTEncMain,
|
||||||
if( structuring->makeMultiMime ) {
|
GPGMEPLUG_OPA_SIGN_CTENC_MAIN );
|
||||||
storeNewCharPtr( &structuring->contentTypeVersion,
|
if( structuring->makeMultiMime ) {
|
||||||
GPGMEPLUG_SIGN_CTYPE_VERSION );
|
storeNewCharPtr( &structuring->contentTypeVersion,
|
||||||
storeNewCharPtr( &structuring->contentDispVersion,
|
GPGMEPLUG_OPA_SIGN_CTYPE_VERSION );
|
||||||
GPGMEPLUG_SIGN_CDISP_VERSION );
|
storeNewCharPtr( &structuring->contentDispVersion,
|
||||||
storeNewCharPtr( &structuring->contentTEncVersion,
|
GPGMEPLUG_OPA_SIGN_CDISP_VERSION );
|
||||||
GPGMEPLUG_SIGN_CTENC_VERSION );
|
storeNewCharPtr( &structuring->contentTEncVersion,
|
||||||
storeNewCharPtr( &structuring->bodyTextVersion,
|
GPGMEPLUG_OPA_SIGN_CTENC_VERSION );
|
||||||
GPGMEPLUG_SIGN_BTEXT_VERSION );
|
storeNewCharPtr( &structuring->bodyTextVersion,
|
||||||
storeNewCharPtr( &structuring->contentTypeCode,
|
GPGMEPLUG_OPA_SIGN_BTEXT_VERSION );
|
||||||
GPGMEPLUG_SIGN_CTYPE_CODE );
|
storeNewCharPtr( &structuring->contentTypeCode,
|
||||||
storeNewCharPtr( &structuring->contentDispCode,
|
GPGMEPLUG_OPA_SIGN_CTYPE_CODE );
|
||||||
GPGMEPLUG_SIGN_CDISP_CODE );
|
storeNewCharPtr( &structuring->contentDispCode,
|
||||||
storeNewCharPtr( &structuring->contentTEncCode,
|
GPGMEPLUG_OPA_SIGN_CDISP_CODE );
|
||||||
GPGMEPLUG_SIGN_CTENC_CODE );
|
storeNewCharPtr( &structuring->contentTEncCode,
|
||||||
|
GPGMEPLUG_OPA_SIGN_CTENC_CODE );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
storeNewCharPtr( &structuring->flatTextPrefix,
|
||||||
|
GPGMEPLUG_OPA_SIGN_FLAT_PREFIX );
|
||||||
|
storeNewCharPtr( &structuring->flatTextSeparator,
|
||||||
|
GPGMEPLUG_OPA_SIGN_FLAT_SEPARATOR );
|
||||||
|
storeNewCharPtr( &structuring->flatTextPostfix,
|
||||||
|
GPGMEPLUG_OPA_SIGN_FLAT_POSTFIX );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
storeNewCharPtr( &structuring->flatTextPrefix,
|
structuring->includeCleartext = GPGMEPLUG_DET_SIGN_INCLUDE_CLEARTEXT;
|
||||||
GPGMEPLUG_SIGN_FLAT_PREFIX );
|
structuring->makeMimeObject = GPGMEPLUG_DET_SIGN_MAKE_MIME_OBJECT;
|
||||||
storeNewCharPtr( &structuring->flatTextSeparator,
|
if( structuring->makeMimeObject ) {
|
||||||
GPGMEPLUG_SIGN_FLAT_SEPARATOR );
|
structuring->makeMultiMime = GPGMEPLUG_DET_SIGN_MAKE_MULTI_MIME;
|
||||||
storeNewCharPtr( &structuring->flatTextPostfix,
|
storeNewCharPtr( &structuring->contentTypeMain,
|
||||||
GPGMEPLUG_SIGN_FLAT_POSTFIX );
|
GPGMEPLUG_DET_SIGN_CTYPE_MAIN );
|
||||||
|
storeNewCharPtr( &structuring->contentDispMain,
|
||||||
|
GPGMEPLUG_DET_SIGN_CDISP_MAIN );
|
||||||
|
storeNewCharPtr( &structuring->contentTEncMain,
|
||||||
|
GPGMEPLUG_DET_SIGN_CTENC_MAIN );
|
||||||
|
if( structuring->makeMultiMime ) {
|
||||||
|
storeNewCharPtr( &structuring->contentTypeVersion,
|
||||||
|
GPGMEPLUG_DET_SIGN_CTYPE_VERSION );
|
||||||
|
storeNewCharPtr( &structuring->contentDispVersion,
|
||||||
|
GPGMEPLUG_DET_SIGN_CDISP_VERSION );
|
||||||
|
storeNewCharPtr( &structuring->contentTEncVersion,
|
||||||
|
GPGMEPLUG_DET_SIGN_CTENC_VERSION );
|
||||||
|
storeNewCharPtr( &structuring->bodyTextVersion,
|
||||||
|
GPGMEPLUG_DET_SIGN_BTEXT_VERSION );
|
||||||
|
storeNewCharPtr( &structuring->contentTypeCode,
|
||||||
|
GPGMEPLUG_DET_SIGN_CTYPE_CODE );
|
||||||
|
storeNewCharPtr( &structuring->contentDispCode,
|
||||||
|
GPGMEPLUG_DET_SIGN_CDISP_CODE );
|
||||||
|
storeNewCharPtr( &structuring->contentTEncCode,
|
||||||
|
GPGMEPLUG_DET_SIGN_CTENC_CODE );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
storeNewCharPtr( &structuring->flatTextPrefix,
|
||||||
|
GPGMEPLUG_DET_SIGN_FLAT_PREFIX );
|
||||||
|
storeNewCharPtr( &structuring->flatTextSeparator,
|
||||||
|
GPGMEPLUG_DET_SIGN_FLAT_SEPARATOR );
|
||||||
|
storeNewCharPtr( &structuring->flatTextPostfix,
|
||||||
|
GPGMEPLUG_DET_SIGN_FLAT_POSTFIX );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bOk;
|
return bOk;
|
||||||
|
Loading…
Reference in New Issue
Block a user