pgp加密解密.net

下载地址:https://www.gnupg.org/download/

参考文章:https://blog.csdn.net/puppylpg/article/details/50901779

加密解密方法:

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;
psi.WorkingDirectory = @"D:\sofe\GnuPG";
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
//解密
string sCommandLine = @"gpg --passphrase 1234567890 --output C:\Users\LWP\Desktop\cc.txt --decrypt C:\Users\LWP\Desktop\cc.txt.gpg";
//加密
//string sCommandLine = @"gpg -r liwenping -e C:\Users\LWP\Desktop\cc.txt";
process.StandardInput.WriteLine(sCommandLine);
process.StandardInput.Flush();
process.StandardInput.Close();
process.WaitForExit();
string result = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
process.Close();
process.Dispose();
}
//使用前先安装好GPG

参考:https://www.cnblogs.com/liwp/p/7217306.html

最后修改:2018 年 05 月 10 日
如果觉得我的文章对你有用,请随意赞赏