private static string Get(PrettyGoodPrivacySettings settings, out string executablePath) { executablePath = EnsureEndsWith(settings.GnuPGPath, "\\") + "gpg.exe"; if (!File.Exists(executablePath)) { throw new InvalidOperationException(string.Format("'gpg.exe' not found at '{0}'.", executablePath)); } var homeDirectory = EnsureEndsWith(settings.GnuPGPath, "\\") + "store"; if (!Directory.Exists(homeDirectory)) { Directory.CreateDirectory(homeDirectory); } return(string.Format("--homedir \"{0}\" --passphrase \"{1}\" --yes ", homeDirectory, settings.Passphase)); }
public void Import(PrettyGoodPrivacySettings settings, string keyFilePath) { string executablePath; string arguments = string.Format(ImportArgumentsXA, Get(settings, out executablePath), keyFilePath); var process = Process.Start(new ProcessStartInfo(executablePath) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = arguments, }); if (process != null) { process.WaitForExit(60000); } }
public static void Encrypt(PrettyGoodPrivacySettings settings, string recipient, string inputFilePath, string outputFilePath) { string executablePath; var arguments = string.Format(EncryptArgumentsXABC, Get(settings, out executablePath), recipient, outputFilePath, inputFilePath); var process = Process.Start(new ProcessStartInfo(executablePath) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true, Arguments = arguments, }); if (process != null) { process.WaitForExit(60000); } }