Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 当所有引用都有效时,Cinchoo.PGP抛出空引用错误_C# 4.0 - Fatal编程技术网

C# 4.0 当所有引用都有效时,Cinchoo.PGP抛出空引用错误

C# 4.0 当所有引用都有效时,Cinchoo.PGP抛出空引用错误,c#-4.0,C# 4.0,我正在使用Cinchoo.PGP解密一些文件。当它运行时,我得到一个“对象引用未设置为对象实例”错误 堆栈跟踪如下所示: at Cinchoo.PGP.ChoPGPEncryptDecrypt.Decrypt(Stream inputStream, Stream outputStream, Stream privateKeyStream, String passPhrase) at Cinchoo.PGP.ChoPGPEncryptDecrypt.DecryptFile(String

我正在使用Cinchoo.PGP解密一些文件。当它运行时,我得到一个“对象引用未设置为对象实例”错误

堆栈跟踪如下所示:

   at Cinchoo.PGP.ChoPGPEncryptDecrypt.Decrypt(Stream inputStream, Stream outputStream, Stream privateKeyStream, String passPhrase)
   at Cinchoo.PGP.ChoPGPEncryptDecrypt.DecryptFile(String inputFilePath, String outputFilePath, String privateKeyFilePath, String passPhrase)
   at EDI2.Data.Process_Unencrypt_File.Process(ReportAllDataViewModel rpt) in C:\TWRAProjects\EDI2\EDI2\Data\Data_Process.cs:line 544
当我逐步完成代码时,所有变量都是正确的。我的文件存在,pgp引用有效,我的“发件人”文件存在(我手动验证过),我的“收件人”文件不存在(相同),并且填充了我的PEMPath和密码短语值

但是,当它运行pgp.DecryptFile行时,会抛出“对象引用”错误

我不确定我是否在Cinchoo.PGP中发现了一个bug,或者我是否做错了什么。有人有什么想法吗?还有其他人经历过吗

谢谢,
Carthax

我们至少需要查看异常的堆栈跟踪。@LasseV.Karlsen:edited因为它在库中崩溃了,我认为这是它的某种缺陷。实际使用了两行
pgp.DecryptFile
中的哪一行?您可能需要将代码简化为概念验证程序,对所有路径进行硬编码,等等。只是为了确保您使用库的方式受到支持。@LasseV.Karlsen:在这种情况下,是第一种。被解密的文件需要保持相同的名称,因此我将其重命名为_to,进行解密,然后从中删除,然后将_重命名为。
   at Cinchoo.PGP.ChoPGPEncryptDecrypt.Decrypt(Stream inputStream, Stream outputStream, Stream privateKeyStream, String passPhrase)
   at Cinchoo.PGP.ChoPGPEncryptDecrypt.DecryptFile(String inputFilePath, String outputFilePath, String privateKeyFilePath, String passPhrase)
   at EDI2.Data.Process_Unencrypt_File.Process(ReportAllDataViewModel rpt) in C:\TWRAProjects\EDI2\EDI2\Data\Data_Process.cs:line 544