C#PgpCore解密非常大的文件失败

时间:2019-11-12 12:00:55

标签: c# encryption pgp

我正在尝试使用PgpCore通过Azure函数PGP解密非常大的文件,但是对于测试文件,输出的处理速度非常快(例如,不到一分钟就解密了512Mb文件),可以解密非常大的文件(例如20GB)失败。

我们在Azure功能上有6个小时的超时,但是该过程似乎从未完成。

解密代码非常简单:

using (Stream inputFileStream = await storageAccess.OpenFileStreamAsync(container, encryptedFilePath))
{
  using (Stream outputFileStream = await storageAccess.OpenWritableStreamAsync(container, outputFilePath))
  {
    using (Stream privateKeyStream = await GetPrivateKeyStream())
    {
      using (PGP pgp = new PGP())
      {
        logging.LogInformation($"Decrypting {encryptedFilePath} to {destinationDirectory}");

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

        logging.LogInformation($"Decryption complete for {encryptedFilePath}");
      }
    }
  }
}

哪里    OpenWritableStreamAsync 返回 blockBlob.OpenWriteAsync() 和    OpenFileStreamAsync 返回 blockBlob.OpenReadAsync()

我看过了,找不到任何可以处理的最大文件参考,更不用说如何更改它了,也没有找到使用缓冲输入流进行解密的示例。

任何人都可以在这里为我指明正确的方向吗?

顺便说一句,我现在正在尝试查看底层的Bouncy Castle库,但是目前我还没有走这条路,那里肯定有一些学习曲线。

感谢阅读,

斯图。

0 个答案:

没有答案