Bug 101103

Summary: receiving breaks for messages encrypted using the cryptography plugin
Product: [Unmaintained] kopete Reporter: Will Stephenson <wstephenson>
Component: ICQ and AIM PluginsAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: johann-nikolaus, rschiele
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Will Stephenson 2005-03-08 15:45:22 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

When sending encrypted messages using the Crypto plugin and ICQ, the passphrase is always rejected.

Apparently ICQ is removing linebreaks from the encrypted message which makes it invalid for gpg:

-----BEGIN PGP MESSAGE-----Version: GnuPG v1.2.6 (GNU/Linux)hQEOA5hc8a9rJVSKEAP9FXrob9PBfvwUG/jjdbCdbwzdrhp4G+pSXTzQTGFJvKsdSLWPcJ2vl06z97xBe2KLxKnIdJSBgzwlY9AWuDLmhWNAgVBP6XdN4SGKW8sFuNcrZd+CkSQFeQjYallN4aadud0+B+Ib4d/5OnADkrX2JAjSBACPBkN5MHq/c64B2MID/0t/Ay97LkltSd2kFDEISB3ZVz1UcHIxI4Cg9bIkcapcKHcQpaKQQ723UFJpqRWjTmeg0cD1AX8iDZlAKZmPEmYfJBl8xB5l+xS1wNxiZG4Si7x+26/WLfGqjYSjgc8s/Mvu7uhrhQb6lSlnuFnqbphwp/i86Ci3t1VAxNnyqxUw0l4Bc7EyjknZ8mCR622I+F/yBDdoYvBQ94Y1I0SgbD49vyohB7jkEoSK236Li7g5GGAhKE2CicvDRcnc4C0RhaOwmNJpNmMin1VatkOKjYRw8B+toV9GJnQP17GEGj4l=ms9h-----END PGP MESSAGE-----
Comment 1 Matt Rogers 2005-03-12 05:38:30 UTC
I tested this with boiko a couple of days ago, and while i don't have his public key so that i could decrypt the messages, they looked correctly formatted in the window. (I was using an icq jabber gateway with psi at the time of receipt). liboscar does nothing to mangle the message. Are we sure this is even a valid bug?
Comment 2 Robert Schiele 2005-03-12 06:49:51 UTC
Matt, how can you test whether kopete does mangle a message on receipt if you used a different application for receipt?

BTW: You can just test with your own PGP key. This bug does not depend on a specific key.
Comment 3 Matt Rogers 2005-03-12 07:44:17 UTC
because the bug is about _sending_ messages from kopete, not receiving them.
Comment 4 Robert Schiele 2005-03-12 07:49:30 UTC
Ah ok, so the description is misleading. In fact the mangling does happen on receiving.
Comment 5 Matt Rogers 2005-03-12 07:55:22 UTC
if somebody could provide debug output, i _might_ take a stab at fixing this...
Comment 6 Will Stephenson 2005-03-17 17:39:09 UTC
Yep, does happen on receipt.  Just sent an encrypted message from kopete to gaim and it was received as correctly formatted gpg 
Comment 7 Matt Rogers 2005-03-17 17:48:34 UTC
still want/need debug output. knowing the client that is sending the message would also be useful. AFAICT, we do nothing to mangle the message on receipt.
Comment 8 Robert Schiele 2005-03-18 00:19:33 UTC
THis is independent of the client used for sending. Tested with both, licq and kopete itself.

And now for the debug output of the receiving kopete:

kopete (oscar - raw protocol): [void ClientStream::bs_readyRead()] recv: 992bytes
kopete (oscar - raw protocol): [void CoreProtocol::addIncomingData(const QByteArray&)] Received 992 bytes.
kopete (oscar - raw protocol): [virtual Transfer* SnacProtocol::parse(const QByteArray&, uint&)] family: 4 subtype: 7 flags: 0 id: 2279965831
kopete (oscar - raw protocol): [virtual bool MessageReceiverTask::take(Transfer*)] icbm cookie is [7d 54 ac 6f 39 ca 42 65 ]
kopete (oscar - raw protocol): [virtual bool MessageReceiverTask::take(Transfer*)] channel is 1
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Got user info for 123098950
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Warning level is 0
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Parsing 4 TLVs
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] User class is 80
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Extended status is 21000000
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Online for 15220
kopete (oscar - raw protocol): [void UserDetails::fill(Buffer*)] Signed on at Thu Mar 17 19:57:56 2005
kopete (oscar - raw protocol): [void MessageReceiverTask::handleType1Message()] Got features tlv. length: 2 data: [01 06 ]
kopete (oscar - raw protocol): [void MessageReceiverTask::handleType1Message()] Message charset: 0 message subcharset: 0
kopete (oscar - raw protocol): [void MessageReceiverTask::handleType1Message()] message is: -----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.0 (GNU/Linux)

hQIOA+PuQhHmd+6VEAgAv1ZRjz6J0CnKheyAza4Kz4fH5mBPXPwdcyvfrppTrAoP
ZolCo8q/IwD8bVIdPWaJheqTTymf9PlI8SDoYe3+RrNvgYKFBAgjxjOQixJQhTGT
VDYrHrCa1WtRacHp3x41UKni2kdnajPPEbUHXIyQlZxugmFik6lBgUxxlxwjN2Oe
5zGsbvBIm5oX9e27mZincEdIHgaHJwam4HXxqV6UrhcM7htw3dAyov/BJxW05Do/
JaOE9ybQA0Eyb5BFreAmPfBY9khhnj0LUk1gwaDVo3XriTjFqhJYA9AgwjxyuZuk
knO7TinLlawD9f4aSggpOdj8P5FmfIarEWbcuatU5QgAqTUat7593kZY7WLBVZaO
t4w4J9ioBSyYlVwdoZotbMs6B76JPH/q7FBiqVE5GAG1OKsNsQiqTaeS4/4ltZrD
lfpAlSk6qATfjs3GKUdmSwIiYeU9LDnsZQkVE0t9u/S0XHZSPnRIlet39XJnYFES
+MV3GcmZJSyvMh6EYfCrUyYYUOzPVrDE434m+xKEnIRkhoUZHluaOiW7ip4VyCPJ
1CSt70krdf41zBrYHkmru0NFVmUtrJ62iWLxwp8ECSYMD1aZ8fB9xqeuC/yHYU3i
hE+pR1hNRoFRcw193HGkCZw+kmNHGIeYN6D6yMZCKc1VuR+6l/ZodsgZP0QrAIL4
79I/AeTv4YQi9qidDBO07JKTHZSgJTA5vuei7Sh7lPZgdmez0vMhODEo82Ds2H4N
6BG7X56dGEv9CivYWxOlQ/i6
=SX5Q
-----END PGP MESSAGE-----
kopete (oscar - raw protocol):
QObject::connect: No such signal Kopete::ChatSession::typingMsg(bool)
QObject::connect:  (sender name:   'unnamed')
QObject::connect:  (receiver name: 'unnamed')
kopete: statistics: new message received
gpg: no valid OpenPGP data found.
gpg: decrypt_message failed: eof
libkopete: [void KopeteSystemTray::addBalloon()] msg text=-----BEGIN PGP MESSAGE-----Ver ...
kopete (history): [void HistoryLogger::saveToDisk()] /home/robert/.kde/share/apps/kopete/logs/ICQProtocol/23497104/123098950.200503.xml saved in 26 ms
libkopete: [void KopeteSystemTray::stopBlink()] stopping movie.
Comment 9 Matt Rogers 2005-03-18 02:02:17 UTC
judging from the debug output, this is not an ICQ bug.
Comment 10 Robert Schiele 2005-03-18 05:49:47 UTC
Which component do you suspect then?

Note that it works for other protocols like Jabber.
Comment 11 Will Stephenson 2005-03-18 09:02:14 UTC
*** Bug 101729 has been marked as a duplicate of this bug. ***
Comment 12 Will Stephenson 2005-03-18 11:07:40 UTC
The problem also exists in groupwise... we are running the crypttext through the richtext processor, which breaks the crypttext of course.
Comment 13 Till Gerken 2005-03-18 11:52:28 UTC
There used to be a similar bug filed against the Jabber plugin, maybe it has been reassigned to the crypto plugin. Can't find it right now but the symptoms were exactly the same.
Comment 14 Olivier Goffart 2005-03-29 18:04:47 UTC
It works verry fine here, with both ICQ, MSN, and Jabber.

The problem is maybe in another plugin,  authoreplace, texteffect, ....
can you have a look ?
Comment 15 Johann-Nikolaus Andreae 2005-03-29 18:33:07 UTC
i have disable all plugins and the problem is still happen.
Comment 16 Olivier Goffart 2005-03-29 19:38:36 UTC
But have you the correct backtrace ?
doe it works with others contacts ? 
others protocols ?

what's your verison of kopete ?
Comment 17 Kenny Johansson 2005-04-03 00:43:10 UTC
It happens here too. Version 0.10 

There seems to be some kind of unescape on the message that removes line breaks (and html-tags).

I look through the code quickly the other day, and saw a reference (in protocols/oscarcontact.cpp) to the plainBody() method. My uneducated guess would that icq-messages are marked as RichText.. 

QString Message::plainBody() const
{
        QString body=d->body;
        if( d->format & RichText )
        {
                body = unescape( body );
        }
        return body;
}

Comment 18 Olivier Goffart 2005-04-03 09:48:56 UTC
unescape should work perfectly.
The problem is still in oscar.
I've found the Bug 102880.

*** This bug has been marked as a duplicate of 102880 ***
Comment 19 Will Stephenson 2005-10-07 14:32:30 UTC
With 3.5, I've found another oscar issue with crypto.  PGP messages are split over two or more oscar messages.  Might it be worth checking incoming messages for BEGIN PGP MESSAGE without END PGP MESSAGE in ChatSession::append, buffering incomplete crypted messages and reassembling them?
Comment 20 Matt Rogers 2006-01-13 04:15:17 UTC
won't / can't support use of cryptography over ICQ due to limitations in the protocol.