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.