本文介绍了命令行GPG解密使用C# - 密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用命令行来加密我发送的文件,但我试图找出如何用同样的方法对其进行解密。如果我运行命令它得到提示输入密码,但我不明白的方式来传递中使用命令行的密码。下面是我如何加密文件:

I'm using the command line to encrypt files that I am sending out but I am trying to figure out how to use the same method to decrypt them. If I run the command it get prompted for the passphrase, but I don't see a way to pass in the passphrase using the command line. Here is how I am encrypting the file:

var proc = new Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.WorkingDirectory = "C:\\";
proc.StartInfo.FileName = @"C:\Progra~1\GNU\GnuPG\gpg.exe";
proc.StartInfo.Arguments = @"-e -u ""[email protected]"" -r ""[email protected]"" ""C:\file.csc""";
proc.Start();
proc.WaitForExit();

**下面是用于我的解决方案是一个有用的链接:http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/38c21304-fc7a-42cc-a5fb-dcb6da7f6411/

** Here is a useful link that was used for my solution:http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/38c21304-fc7a-42cc-a5fb-dcb6da7f6411/

推荐答案

属性的应该给你,你可以用它来提供标准输入的密码中使用StreamWriter。

The property Process.StandardInput should give you a StreamWriter that you can use to provide the passphrase on standard input.

这篇关于命令行GPG解密使用C# - 密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 17:31