リクエストに応じてgpg署名を復号化するコンソールアプリケーションを作成しようとしています。 GPGパスワードを要求する部分を除いて、すべてうまくいっています。パスワードダイアログを使用せずにコマンドラインからgpg --decrypt
に電話するにはどうすればよいですか?コマンドラインからGPG文字列を解読する
はここで、これまでに私のコードです:
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ファイルにパスワードを入れないでください。
ご協力いただきありがとうございます。
感謝を! ftp://ftp.gnupg.org/gcrypt/binary/gnupg-w32cli-1.4.9.exeをダウンロードしてインストールすると、問題が修正されました –