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
http://www.codeguru.com/csharp/.net/net_security/pgp/article.php/c4699/Using-the-Gnu-Privacy-Guard-GnuPGPGP-within-ASPNET-v10.htm
0
 
David Johnson, CD, MVPOwnerCommented:
you can download the windows source here. (ancient code) Unfortunately PGP was purchased by Symantec
http://www.pgpi.org/cgi/download.cgi?filename=pgp651i-win-src.zip
0
 
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
Hi,

You may find following articles which explain this in detail:
http://www.codeproject.com/Articles/457453/PGP-Encryption-with-Csharp
http://www.codeproject.com/Articles/3118/Gnu-Privacy-Guard-GPG-PGP-for-NET-v


Or you may find following API of interest:
https://gpgapi.codeplex.com/


Thanks and Regards,
0
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.