要求に応じてgpg署名を復号化するコンソールアプリケーションを作成しようとしています。GPGパスワードの入力を求められる部分を除いて、すべてが順調に進んでいます。gpg --decrypt
パスワードダイアログなしでコマンドラインから呼び出すにはどうすればよいですか?
これまでの私のコードは次のとおりです。
var startInfo = new ProcessStartInfo("gpg.exe");
startInfo.Arguments = "--decrypt"; //this is where I want to insert "--passphrase MyFakePassword"
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
startInfo.WorkingDirectory = @"C:\Program Files (x86)\GNU\GnuPG";
var proc = Process.Start(startInfo);
var sCommandLine = stringData + "\n"+(char)26+"\n"; //stringData is the encrypted string
proc.StandardInput.WriteLine(sCommandLine);
proc.StandardInput.Flush();
proc.StandardInput.Close();
var result = proc.StandardOutput.ReadToEnd();
入力の最初の行にパスワードを使用して--passphrase MyFakePassword
、--passphrase-fd MyFakePassword
を使用してみました。--passphrase-fd 0
可能であれば、このコードを実行しているマシンのtxtファイルにパスワードを入れないようにしたいと思います。
助けてくれてありがとう。