2

I am having trouble with encrypting/decrypting a tar archive using Bouncy Castle OpenPGP library.

I'm using TarArchiveOutputStream to add files to a tar archive and Bouncy Castle OpenPGP to encrypt the archive. Afterwards I am using Kleopatra to manually decrypt the file using the option "Input file is an archive; unpack with: TAR(PGP compatible)".

After unpacking the archive all files except one are lost and the one remaining has all contents removed. (Also happens with other decrypting programs)

I have already confirmed that the tar archive contains all the files before it is encrypted. I have also tried decrypting with that option unchecked and then the archive also contains all the files. My question is why it doesn't work with that option checked since the input file is indeed an archive so it makes sense to check that option.

What I have also tried:

  • Using another library to make the tar file (JTar)
  • Comparing a manually made tar file to the one generated. The main difference that I saw was that the one made manually was smaller (22KB vs 30KB) while containing same files.

I am open to suggestions. Thanks!

Janar
  • 2,623
  • 1
  • 22
  • 32

0 Answers0