C# Encrypt a File using PGP Encryption

I have a very old process that uses GnuPG. The command line looks like this:

gpg --trust-model always --batch -u [value1] --passphrase [value2] --sign --recipient [value3] -o D:/Temp/testout.gpg -e D:/Temp/testout.txt

Open in new window

How do I achieve the same encryption results in C#?

I've tried using System.Diagnostics.Process but it doesn't work in my service application. I could use a standard PGP library but I'm not sure how to translate the values into usable code. Any help?
LVL 21
Russ SuterAsked:
Who is Participating?
btanExec ConsultantCommented:
The suggested codeproject as shared by expert is useful replacement (i.e. http://www.codeproject.com/Articles/457453/PGP-Encryption-with-Csharp) but note that it is using a wrapper interface (e.g. Starksoft OpenPGP component for .NET) to eventually execute the gpg installed in the machine. the keyring is unqiue to GnuPG so it is wrapper based or process  via C# to execute the cmd (i.e. http://www.codeproject.com/Articles/22055/Automated-File-Decryption-Using-GnuPG-and-C)

another wrapper is GnuPGWrapper v1.0, a wrapper class for GnuPG
David Johnson, CD, MVPOwnerCommented:
you can download the windows source here. (ancient code) Unfortunately PGP was purchased by Symantec
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:

You may find following articles which explain this in detail:

Or you may find following API of interest:

Thanks and Regards,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.