public void GPG()
{
string password = "1234567890";加密
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;.net
psi.WorkingDirectory = @"D:\sofe\GnuPG";
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);blog
//解密
string sCommandLine = @"gpg --passphrase 1234567890 --output C:\Users\LWP\Desktop\cc.txt --decrypt C:\Users\LWP\Desktop\cc.txt.gpg";cmd
//加密
//string sCommandLine = @"gpg -r liwenping -e C:\Users\LWP\Desktop\cc.txt";string
process.StandardInput.WriteLine(sCommandLine);it
process.StandardInput.Flush();
process.StandardInput.Close();error
process.WaitForExit();top
string result = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
process.Close();
process.Dispose();
}word
//使用前先安裝好GPGdi
//注 本人密鑰和私鑰還沒有上傳過,請另行註冊
//參考 http://blog.csdn.net/puppylpg/article/details/50901779