Premature end of stream in PartialInputStream

1,345 views
Skip to first unread message

Marco Iovoli

unread,
May 29, 2014, 12:37:52 PM5/29/14
to didisof...@googlegroups.com
I'm getting a "Premature end of stream in PartialInputStream" error when I try to decrypt an encrypted file. The encrypted file does get decrypted though with the exception of the last sentence (which is when the error occurs). The stack trace is:

   at Org.BouncyCastle.Bcpg.BcpgInputStream.PartialInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Org.BouncyCastle.Bcpg.BcpgInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at DidiSoft.Pgp.PGPLib.ParseLiteralData(PgpLiteralData ld, PgpOnePassSignature ops, Stream fOut)
   at DidiSoft.Pgp.PGPLib.ParseLiteralDataTo(PgpLiteralData ld, PgpOnePassSignature signature, String folderName)
   at DidiSoft.Pgp.PGPLib.ParseCompressedDataTo(PgpCompressedData message, Boolean verifySignature, KeyStore keyStore, Stream publicKeyStream, String outputFolderLocation)
   at DidiSoft.Pgp.PGPLib.ParseEncryptedDataTo(PgpEncryptedDataList enc, Boolean signatureVerify, KeyStore keyStore, Stream privateKeyStream, String passwd, Stream publicKeyStream, String outputFolderLocation)
   at DidiSoft.Pgp.PGPLib.DecryptStreamInFolder(Stream encryptedStream, Stream privateKeyStream, String privateKeyPassword, String outputFolderLocation)
   at DidiSoft.Pgp.PGPLib.DecryptTo(String encryptedFile, String privateKeyFile, String privateKeyPassword, String outputFolderLocation)
   at AMGH.CoreLayer.Security.PGP.FileCrypto.DecryptFile(ApplicationData appData, String encryptedFile, String privateKeyFile, String privateKeyPassword, String outputFolder) in c:\_ROOT\n-TierDev\\Security\PGP\FileCrypto.cs:line 42

I have tried everything decryptTo, DecryptFile, etc.and always get the same error. I have set the ContentType to Text and Utf8 without any improvement. I have also tried to load in memorystream and still get same error.

The encrypted file is plain text.

didisoft

unread,
May 29, 2014, 1:35:48 PM5/29/14
to didisof...@googlegroups.com
Hi Marco,

Do you have by any chance test encrypted file that fails, of course with the corresponding private key?

Or eventually do you know what software was used for the encryption.

Best Regards,
Peter Kalef
DidiSoft Technical Support

Marco Iovoli

unread,
May 29, 2014, 1:52:38 PM5/29/14
to didisof...@googlegroups.com
Hi Peter,
I'm trying to find out what software was used to encrypt the file. I will post as soon as I know. But I have attached the private key file (i'll regenerate a new key pair, after this is fixed) and the encrypted file causing the issue.

For your information, when I encrypt a file using the exact same public key I gave them, the decryption works fine for both encrypted ascii or binary file. Hope you can help with this.
Thanks.
amghconprivate.asc
extract_encryption_test_t0002291trnt_201405280740.txt.pgp

didisoft

unread,
May 30, 2014, 9:25:35 AM5/30/14
to didisof...@googlegroups.com
Thank you for sending me the files Marco,

An updated version of the library has been released today where this error should have been fixed.

You can download the updated version from our customers' section located at http://www.didisoft.com/customers/

Marco Iovoli

unread,
Jun 2, 2014, 11:33:29 AM6/2/14
to didisof...@googlegroups.com
Hi Peter, Thanks for the update.
Reply all
Reply to author
Forward
0 new messages