mattosaurus / PgpCore

.NET Core class library for using PGP
MIT License
245 stars 98 forks source link

Unknown object in stream 47 #121

Closed dracos1993 closed 3 years ago

dracos1993 commented 3 years ago

Hi @mattosaurus ,

I am trying to use the DecryptStreamAsync method to decrypt and it was working fine. Except for this one client, for which I am getting this error, "Unknown object in stream 47"

pgp.DecryptStream(encryptedFileStream, outputFileStream, privateKeyStream, password);

I've tried using the DecryptFile method too, but get the same error with that. Unfortunately it's not easy to ask the client to check their file. I found a BouncyCastle post about the same thing and it seems like this exception could be caught and it will continue decrypting the file.

http://bouncy-castle.1462172.n4.nabble.com/unknown-object-in-stream-XX-td1467126.html

https://www.bouncycastle.org/devmailarchive/msg06901.html

Appreciate any help on this.

Thanks, Daniel

mattosaurus commented 3 years ago

Hi,

Are you able to provide a file to me that replicates this error and I'll have a look into it? Alternately if you're only seeing this with a file that contains client data which you don't want to provide then would you be able to debug it yourself and submit a PR request witt a fix. I'd rather not put a geneeric try/catch around the whole method so if we can figure out exactly where it's going wrong then hopefully we can be a bit more targeted.

dracos1993 commented 3 years ago

Actually @mattosaurus , your library is working perfectly fine! The issue was with the file. We were uploading it to a blob storage from an SFTP site and the upload action corrupted the file during the upload.

This can be closed.