Commit 0b476b10 authored by Sandro Knauß's avatar Sandro Knauß
Browse files

Fixing newline issue with mailcomposer

Newlines for PGP inline signed/enc+signed mails are wrongly handled.
Newlines are replaced by <CR><LF> before creating the signature. This is
not recommended for inline messages.

BUG: 313478
FIXED-IN: 4.10.2
REVIEW: 109634
parent 6f9b3639
......@@ -171,16 +171,18 @@ void SignEncryptJob::process()
kDebug() << "creating signencrypt from:" << proto->name() << proto->displayName();
std::auto_ptr<Kleo::SignEncryptJob> job( proto->signEncryptJob( !d->binaryHint( d->format ), d->format == Kleo::InlineOpenPGPFormat ) );
QByteArray encBody;
d->content->assemble();
// replace simple LFs by CRLFs for all MIME supporting CryptPlugs
// according to RfC 2633, 3.1.1 Canonicalization
d->content->assemble();
QByteArray content;
if( d->format & Kleo::InlineOpenPGPFormat ) {
content = KMime::LFtoCRLF( d->content->body() );
} else {
content = d->content->body();
} else if ( !( d->format & Kleo::SMIMEOpaqueFormat ) ) {
content = KMime::LFtoCRLF( d->content->encodedContent() );
}
} else { // SMimeOpaque doesn't need LFtoCRLF, else it gets munged
content = d->content->encodedContent();
}
// FIXME: Make this async
......@@ -205,7 +207,7 @@ void SignEncryptJob::process()
QByteArray signatureHashAlgo = res.first.createdSignature( 0 ).hashAlgorithmAsString();
d->resultContent = Message::Util::composeHeadersAndBody( d->content, encBody, d->format, true, signatureHashAlgo );
// d->resultContent->setBody( signature );
emitResult();
}
......
......@@ -157,21 +157,19 @@ void SignJob::process()
// for now just do the main recipients
QByteArray signature;
d->content->assemble();
// replace simple LFs by CRLFs for all MIME supporting CryptPlugs
// according to RfC 2633, 3.1.1 Canonicalization
d->content->assemble();
QByteArray content;
//
if( d->format & Kleo::InlineOpenPGPFormat &&
!( d->format & Kleo::SMIMEOpaqueFormat ) ) {
content = KMime::LFtoCRLF( d->content->body() );
if( d->format & Kleo::InlineOpenPGPFormat ) {
content = d->content->body();
} else if( !( d->format & Kleo::SMIMEOpaqueFormat ) ) {
content = KMime::LFtoCRLF( d->content->encodedContent() );
} else { // SMimeOpaque doesn't need LFtoCRLF, else it gets munged
} else { // SMimeOpaque doesn't need LFtoCRLF, else it gets munged
content = d->content->encodedContent();
}
// FIXME: Make this async
GpgME::SigningResult res = job->exec( d->signers,
content,
......@@ -189,7 +187,7 @@ void SignJob::process()
job->deleteLater();
QByteArray signatureHashAlgo = res.createdSignature( 0 ).hashAlgorithmAsString();
d->resultContent = Message::Util::composeHeadersAndBody( d->content, signature, d->format, true, signatureHashAlgo );
emitResult();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment