signing of mail bodies is working now - buuuuut: I changed the behaviour of the 'signMessage()' function, it now returns *only* the signature part (with a trailing zero). This is neccessary to avoid confugion at the KMail side: otherwise KMail might try to convert the whole MIME block into quoted printable - of course this is only allowed for the body part but not for the signature part.
This commit is contained in:
parent
09b1be8339
commit
64da5fc845
@ -698,6 +698,7 @@ bool signMessage( const char* cleartext,
|
|||||||
const char* certificate )
|
const char* certificate )
|
||||||
{
|
{
|
||||||
GpgmeCtx ctx;
|
GpgmeCtx ctx;
|
||||||
|
GpgmeError err;
|
||||||
GpgmeData data, sig;
|
GpgmeData data, sig;
|
||||||
size_t rDLen, rSLen;
|
size_t rDLen, rSLen;
|
||||||
char* rData = 0;
|
char* rData = 0;
|
||||||
@ -721,7 +722,7 @@ bool signMessage( const char* cleartext,
|
|||||||
if( !ciphertext )
|
if( !ciphertext )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
gpgme_new (&ctx);
|
err = gpgme_new (&ctx);
|
||||||
gpgme_set_protocol (ctx, GPGMEPLUG_PROTOCOL);
|
gpgme_set_protocol (ctx, GPGMEPLUG_PROTOCOL);
|
||||||
|
|
||||||
|
|
||||||
@ -759,18 +760,24 @@ bool signMessage( const char* cleartext,
|
|||||||
|
|
||||||
*ciphertext = malloc( rDLen + rSLen + 1000 );
|
*ciphertext = malloc( rDLen + rSLen + 1000 );
|
||||||
if( *ciphertext ) {
|
if( *ciphertext ) {
|
||||||
|
/*
|
||||||
strcpy( (char*)*ciphertext,
|
strcpy( (char*)*ciphertext,
|
||||||
"Content-Type: multipart/signed;\r\n"
|
"Content-Type: multipart/signed;\r\n"
|
||||||
" protocol=\"application/pgp-signature\";\r\n"
|
" protocol=\"application/pgp-signature\";\r\n"
|
||||||
" boundary=\"42=.42=.42=.42\"\r\n"
|
" boundary=\"42=.42=.42=.42\"\r\n"
|
||||||
"\r\n--42=.42=.42=.42\r\n" );
|
"\r\n--42=.42=.42=.42\r\n\r\n" );
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
strcpy( (char*)*ciphertext, "--42=.42=.42=.42\r\n"
|
||||||
|
"Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"
|
||||||
|
"Content-Transfer-Encoding: 7bit\r\n\r\n" );
|
||||||
strncat((char*)*ciphertext, rData, rDLen );
|
strncat((char*)*ciphertext, rData, rDLen );
|
||||||
strcat( (char*)*ciphertext,
|
strcat( (char*)*ciphertext,
|
||||||
"\r\n--42=.42=.42=.42\r\n"
|
"\r\n\r\n--42=.42=.42=.42\r\n"
|
||||||
"Content-Type: application/pgp-signature\r\n\r\n" );
|
"Content-Type: application/pgp-signature\r\n\r\n" );
|
||||||
strncat((char*)*ciphertext, rSig, rSLen );
|
*/
|
||||||
strcat( (char*)*ciphertext,
|
strncpy((char*)*ciphertext, rSig, rSLen );
|
||||||
"\r\n--42=.42=.42=.42--\r\n" );
|
((char*)(*ciphertext))[rSLen] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpgme_release (ctx);
|
gpgme_release (ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user