Page MenuHome GnuPG

gpgtar invalid octal number
Closed, ResolvedPublic

Description

Dear Sir or Madam,

sometimes if I encrypt and sign a tar file created with 7-zip on Windows 10 the result can't be decrypted with Kleopatra anymore. The file is getting assigned to me and another person in the "encrypt for other persons" dialog. To start the process I'm using the GPGex extension for Windows which starts Kleopatra and the decryption or encryption process.

If I decrypt the file with gpg on the command line the output is okay.

In Kleopatra the following error is displayed at the end of the decryption process

Fehler während der Ausführung von C:/Program Files (x86)/Gpg4win/../GnuPG/bin/gpgtar.exe: gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: warning: name not terminated by a nul gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: header block 2 is corrupt (size=0 type=8 nrec=0) gpgtar: error creating '{name}.tar_1_/ {ip}_{name} ': Invalid argument

This error seems to be sporadically, I was thinking this is a problem with large files but all my tests after the error appeared did work correctly. I was testing with a folder containing around 800mb of data. I was trying to encrypt the folder itself or creating a tar with 7-zip first encrypting the .tar result. In both cases, the file was okay after checking.

I will try to reproduce this error on my daily work and post additional information as soon as I find some.

Software Versions:

  • Windows 10 Home Version 1809
  • Kleopatra Version 3.1.7-gpg4win-3.1.7

Best regards

Simon Aberle

Related Objects

Event Timeline

aheinecke added a subscriber: aheinecke.

Maybe the file was encrypted with a version of gpg4win-3.1.5? We had a serious bug there that sometimes files were corrupted. See: T4332

If the data is not recoverable by other means I can lead you through the process to "fix the file" but this involves Hex editing.

I did encrypt the file myself with the version mentioned above.

I was able to decrypt it with the command line but not with Kleopatra.

Just to clarify, you were able to decrypt and extract it without error? Which tool did you use to extract the tar archive?

That would be interesting. I assumed the problem from T4332 only occured when creating archives. But maybe we have the same problem when decrypting archives.

I'll try to do some more tests but not before the next release.

I was creating a tar archive with 7-Zip on my Windows 10 machine. After the creating was completed I was encrypting the archive like so:

The encryption process was done with Kleopatra via the GPGex menu (Sign and encrypt). After the process was completed successfully I was trying to check the result with the validate entry in the GPGex menu. Kleopatra did show the error I wrote down above.

So I was switching to the command line running the command for decrypt the file via gpg:

gpg -e -o {targetFile} {sourceFile}

The result was a readable tar file without any errors, but trying the same steps with Kleopatra was leading to the mentioned error above all the time. I was getting the error two time not sure how to "trigger" it. Since I did create the bug report the problem was not appearing anymore.

I was able to reporduce this error with the following steps:

  1. Creating a tar file (Without compression) from a folder containing 16 elements (kdbx files) with a total of 0,98 MB of data
  2. Checking the tar archive if everything is fine
  3. Clicking the file with the right mouse button -> Sign and encrypt (GPGex extension)
  4. In Kleopatra
    1. Sign with my Signature
    2. Encrypt for myself
    3. Encrypt for someone else (my work signature)
    4. Pressing the Sign / Encrypt button
  5. After the task is completed pressing the done button
  6. On the newly created .gpg file right click -> decrypt and validate
  7. In Kleopatra the following error was shown.
Eingabefehler: Fehler während der Ausführung von F:/Program Files (x86)/Gpg4win/../GnuPG/bin/gpgtar.exe: gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: warning: garbage after name gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: invalid octal number encountered - assuming 0 gpgtar:
[stdin]: header block 2 is corrupt (size=0 type=8 nrec=0) gpgtar: error creating '{FileName}.tar_1_/Ù¢šgûKµ': Invalid argument

Checking if the archive is really broken

  1. Deleting the .tar archive created by 7-zip so I will not fool myself
  2. Open up the Power-Shell, navigation to the folder with the created gpg file
  3. Running the following command: 'gpg -d -o Backup.tar .\{FileName}.tar.gpg'
    1. The signature shown in the terminal is correct
  4. Open up the created Backup.tar file and check the content

The file seems to be okay I was able to extract a file and open it up with KeePass2. Unlocking the Database with KeePass did show all the entries saved in the Database.

Hopefully the problem get's reproducible with the steps mentioned above.

I did forget to mention that the key I'm using is 4096 bit long

This applies to my private and my work key, maybe this is part of the problem

ebo claimed this task.
ebo added a subscriber: ebo.

This ticket is obsolete, we did some work on gpgtar since then. Should the issue still occur, please reopen or create a new ticket

This problem was also reported at https://bugs.kde.org/show_bug.cgi?id=479567#c1

I could not reproduce the problem with some random PDF files named as in the bug report in the signed and encrypted archive.

If the problem still occurs we need an archive which reproduces the problem.

If 7z is used to create a tarball that tarball is then 7z compressed. At least this is how I understand the case.
When gpgtar now tries to extract the file it sees a 7z file and thus emits the octal number warnings because it assumes a tarball (after decryption by gpg).