I need to write a C# program for the encrypting and decrypting of files with PGP. I can't seem to find adequate resources in the Internet. Can someone maybe help?

Try this, I did it this way and it worked wonders, in this link you will find more details.

http://www.systemdeveloper.info/2013/11/decrypt-files-encrypted-with-gnupg-from.html

public static string DecryptFile(string encryptedFilePath)
        {
            FileInfo info = new FileInfo(encryptedFilePath);
            string decryptedFileName = info.FullName.Substring(0, info.FullName.LastIndexOf('.')) + "Dec.TXT";
            string encryptedFileName = info.FullName;

            string password = System.Configuration.ConfigurationManager.AppSettings["passphrase"].ToString();

            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 = @System.Configuration.ConfigurationManager.AppSettings["WorkingDirectory"].ToString();

            System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
            string sCommandLine = @"echo " + password + "|gpg.exe --passphrase-fd 0 --batch --verbose --yes --output " + decryptedFileName + @" --decrypt " + encryptedFileName;

            process.StandardInput.WriteLine(sCommandLine);
            process.StandardInput.Flush();
            process.StandardInput.Close();
            process.WaitForExit();
            //string result = process.StandardOutput.ReadToEnd();
            //string error = process.StandardError.ReadToEnd();
            process.Close();
            return decryptedFileName;
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.