Kmail with gpg attachments #49

Open
opened 10 months ago by deloptes · 7 comments
Collaborator

Basic information

  • TDE version: R14.1
  • Distribution: Debian Buster
  • Hardware: amd64

Description

with some message containging GPG encrypted attachment, when saving this attachment and running gpg --decrypt I get following

gpg: Fatal: zlib inflate problem: invalid distance code

When downloading the same file via roundcube (webmail) the command gpg --decrypt works

Steps to reproduce

  1. Not clear how to reproduce. Some files work some doesn't or

Screenshots

<!-- This is a comment. Please fill in the required fields below. The comments provide instructions on how to do so. Note: You do not need to remove comments. --> ## Basic information - TDE version: R14.1 - Distribution: Debian Buster - Hardware: amd64 <!-- Use SL/* labels to set the severity level. Please do not set a milestone. --> ## Description with some message containging GPG encrypted attachment, when saving this attachment and running `gpg --decrypt` I get following `gpg: Fatal: zlib inflate problem: invalid distance code` When downloading the same file via roundcube (webmail) the command `gpg --decrypt` works ## Steps to reproduce 1. Not clear how to reproduce. Some files work some doesn't or ## Screenshots <!-- If it seems useful, please provide provide one or more screenshots. -->
Owner

Hi Emanoil, are you able to create a test email msg that we could use for troubleshooting? You could save the email here as attachment or send it to me in private email.

Hi Emanoil, are you able to create a test email msg that we could use for troubleshooting? You could save the email here as attachment or send it to me in private email.
Poster
Collaborator

Hi Michele,
I am not sure how to reproduce it.
It happens when a friend sends encrypted messages to me, but not all the time.
I'll have to work on reproducibility first - could be that it is how attachments are handled. I'll try my best - but it is not that high prio as there is work around.

regards

Hi Michele, I am not sure how to reproduce it. It happens when a friend sends encrypted messages to me, but not all the time. I'll have to work on reproducibility first - could be that it is how attachments are handled. I'll try my best - but it is not that high prio as there is work around. regards
Poster
Collaborator

I will put it on my todo. It happens occasonally . From what I remember the parsers in TDE are very tricky and hard to understand, so it seems in some mails it eats up one byte and this causes the fail

Stored from KMail
29188 Oct 13 09:59 Spaetsommer1.odt.gpg

gpg --decrypt Spaetsommer1.odt.gpg > Spaetsommer1.odt
gpg: enabled debug flags: memstat
gpg: encrypted with 4096-bit RSA key, ID xxxx, created 2020-05-01
gpg: encrypted with 2048-bit ELG key, ID xxxx, created 2020-01-01
gpg: Fatal: zlib inflate problem: invalid distance too far back

Sotred from WebMail
29189 Oct 13 10:01 Spaetsommer1.odt.gpg

gpg --decrypt Oktober1.odt.gpg > Oktober1.odt
gpg: enabled debug flags: memstat
gpg: encrypted with 4096-bit RSA key, ID xxxx, created 2020-05-01
gpg: keydb: handles=3 locks=0 parse=0 get=5
gpg: build=0 update=0 insert=0 delete=0
gpg: reset=2 found=5 not=0 cache=0 not=0
gpg: kid_not_found_cache: count=0 peak=0 flushes=0
gpg: sig_cache: total=11 cached=11 good=11 bad=0
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
gpg: secmem usage: 0/65536 bytes in 0 blocks

I will put it on my todo. It happens occasonally . From what I remember the parsers in TDE are very tricky and hard to understand, so it seems in some mails it eats up one byte and this causes the fail Stored from KMail 29188 Oct 13 09:59 Spaetsommer1.odt.gpg gpg --decrypt Spaetsommer1.odt.gpg > Spaetsommer1.odt gpg: enabled debug flags: memstat gpg: encrypted with 4096-bit RSA key, ID xxxx, created 2020-05-01 gpg: encrypted with 2048-bit ELG key, ID xxxx, created 2020-01-01 **gpg: Fatal: zlib inflate problem: invalid distance too far back** Sotred from WebMail 29189 Oct 13 10:01 Spaetsommer1.odt.gpg gpg --decrypt Oktober1.odt.gpg > Oktober1.odt gpg: enabled debug flags: memstat gpg: encrypted with 4096-bit RSA key, ID xxxx, created 2020-05-01 gpg: keydb: handles=3 locks=0 parse=0 get=5 gpg: build=0 update=0 insert=0 delete=0 gpg: reset=2 found=5 not=0 cache=0 not=0 gpg: kid_not_found_cache: count=0 peak=0 flushes=0 gpg: sig_cache: total=11 cached=11 good=11 bad=0 gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0 outmix=0 getlvl1=0/0 getlvl2=0/0 gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0 gpg: secmem usage: 0/65536 bytes in 0 blocks
Owner

I will put it on my todo.

Ok, sounds great (y)

> I will put it on my todo. Ok, sounds great (y)
Poster
Collaborator

Another error (just as reminder for me which context should I test). Again the file saved from kmail is one byte less and not working

$ gpg --decrypt Oktober2.odt.gpg > Oktober2.odt
gpg: enabled debug flags: memstat
gpg: encrypted with 4096-bit RSA key, ID xxxxxxxx, created 2020-05-01
gpg: encrypted with 2048-bit ELG key, ID xxxxxxxx, created 2020-01-01
gpg: Fatal: zlib inflate problem: incorrect data check
$ ls -al Oktober2.odt*
-rw-r--r-- 1 emanoil emanoil     0 Oct 17 10:33 Oktober2.odt
-rw-r--r-- 1 emanoil emanoil 39935 Oct 17 10:32 Oktober2.odt.gpg
$ ls -al Oktober2.odt*
-rw-r--r-- 1 emanoil emanoil     0 Oct 17 10:33 Oktober2.odt
-rw-r--r-- 1 emanoil emanoil 39936 Oct 17 10:34 Oktober2.odt.gpg
$ gpg --decrypt Oktober2.odt.gpg > Oktober2.odt
gpg: enabled debug flags: memstat
gpg: encrypted with 4096-bit RSA key, ID xxxxxxxx, created 2020-05-01
gpg: encrypted with 2048-bit ELG key, ID xxxxxxxx, created 2020-01-01
gpg: keydb: handles=3 locks=0 parse=0 get=5
gpg:        build=0 update=0 insert=0 delete=0
gpg:        reset=2 found=5 not=0 cache=0 not=0
gpg: kid_not_found_cache: count=0 peak=0 flushes=0
gpg: sig_cache: total=11 cached=11 good=11 bad=0
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
gpg: secmem usage: 0/65536 bytes in 0 blocks
Another error (just as reminder for me which context should I test). Again the file saved from kmail is one byte less and not working ``` $ gpg --decrypt Oktober2.odt.gpg > Oktober2.odt gpg: enabled debug flags: memstat gpg: encrypted with 4096-bit RSA key, ID xxxxxxxx, created 2020-05-01 gpg: encrypted with 2048-bit ELG key, ID xxxxxxxx, created 2020-01-01 gpg: Fatal: zlib inflate problem: incorrect data check $ ls -al Oktober2.odt* -rw-r--r-- 1 emanoil emanoil 0 Oct 17 10:33 Oktober2.odt -rw-r--r-- 1 emanoil emanoil 39935 Oct 17 10:32 Oktober2.odt.gpg $ ls -al Oktober2.odt* -rw-r--r-- 1 emanoil emanoil 0 Oct 17 10:33 Oktober2.odt -rw-r--r-- 1 emanoil emanoil 39936 Oct 17 10:34 Oktober2.odt.gpg $ gpg --decrypt Oktober2.odt.gpg > Oktober2.odt gpg: enabled debug flags: memstat gpg: encrypted with 4096-bit RSA key, ID xxxxxxxx, created 2020-05-01 gpg: encrypted with 2048-bit ELG key, ID xxxxxxxx, created 2020-01-01 gpg: keydb: handles=3 locks=0 parse=0 get=5 gpg: build=0 update=0 insert=0 delete=0 gpg: reset=2 found=5 not=0 cache=0 not=0 gpg: kid_not_found_cache: count=0 peak=0 flushes=0 gpg: sig_cache: total=11 cached=11 good=11 bad=0 gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0 outmix=0 getlvl1=0/0 getlvl2=0/0 gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0 gpg: secmem usage: 0/65536 bytes in 0 blocks ```
Poster
Collaborator

@MicheleC do you know where is the base64 decoding for the mail attachment happening?

I did copy the base64 portion from the mail decoded and gpg was eble to decrypt.
Consequently there is a problem either in the base64 decoding or in the save/write to disk, but I bet on the first one.

@MicheleC do you know where is the base64 decoding for the mail attachment happening? I did copy the base64 portion from the mail decoded and gpg was eble to decrypt. Consequently there is a problem either in the base64 decoding or in the save/write to disk, but I bet on the first one.
Owner

@deloptes
not out of my mind, but a quick rg "decode(" in kmail folder gives a good pointer.

kmmsgpart.cpp
346:        result = codec->decode( mBody );
387:        if ( !codec->decode( iit, mBody.end(), oit, oend ) )

There are more results of course, but the one above is where I would start to look at.

@deloptes not out of my mind, but a quick rg "decode\(" in kmail folder gives a good pointer. ``` kmmsgpart.cpp 346: result = codec->decode( mBody ); 387: if ( !codec->decode( iit, mBody.end(), oit, oend ) ) ``` There are more results of course, but the one above is where I would start to look at.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.