Closed rogerhival closed 3 years ago
Hi, thanks for raising. Yeah, looks like that ine should be within the using statement.
Do you have an example of when you're hitting this error? It didn't show up on any of the tests so might need to adjust them.
The scenario I have is I download a file from here (any file): http://distr.tullverket.se/tulltaxan/xml/dif/ And I'm using a public key they provide on : http://distr.tullverket.se/tulltaxan/Tulltaxan_Fildistribution.asc
Running the following code: static async Task Main(string[] args) { var SEFilePath = @"D:\PGPDecryptTesting\PGPDecryptTesting\SEFile.xml.gz.pgp"; var SEKeyFilePath = new FileInfo(@"D:\PGPDecryptTesting\PGPDecryptTesting\key.asc"); var SEOutputFilePath = @"D:\PGPDecryptTesting\PGPDecryptTesting\SEFile.xml.gz";
var encriptionKeys = new EncryptionKeys(SEKeyFilePath);
using (PGP pgp = new PGP())
{
await pgp.DecryptFileAsync(SEFilePath, SEOutputFilePath, encriptionKeys);
}
}
Gives me: System.ObjectDisposedException: 'Cannot access a closed file.'
I've published v5.3.1 which has fixed this now. Thanks for pointing it out.
Hi,
This does not look right: Line 4314 on PGP.cs
if (message is PgpCompressedData cData) { PgpObjectFactory of = null;
when getting the message = Utilities.SkipSignatureList(of) the stream is closed..