First of all, don't "answer" your own question. Edit the original post if you want to add information.
Secondly, posting all of your code does not help. You only want to post the code that isn't working.
Thirdly, you didn't tell us what wasn't working. When you post the code that doesn't work, tell us which line is throwing an error and what error it is throwing. We're not mind readers, and we're not going to try out your code for you.
To add to that, you posted this code:
private static void EncryptAndSign(string strPublicKeyFileName, string strPrivateKeyFileName,
string strFileToEncrypt)
{
string PublicKeyFileName = strPublicKeyFileName;
string PrivateKeyFileName = strPrivateKeyFileName;
string EncryptedFileName = "EncryptedFile.txt";
string FileToEncrypt = strFileToEncrypt;
PgpEncryptionKeys encryptionKeys = new PgpEncryptionKeys(PublicKeyFileName,
PrivateKeyFileName,
"vergeet10191");
PgpEncrypt encrypter = new PgpEncrypt(encryptionKeys);
using (Stream outputStream = File.Create(FileToEncrypt))
{
encrypter.EncryptAndSign(outputStream, new FileInfo(FileToEncrypt));
}
}
Why do you take two strings as input, and then store them in two completely different strings without saving them? I'm talking about:
string PublicKeyFileName = strPublicKeyFileName;
string PrivateKeyFileName = strPrivateKeyFileName;
That's a total waste of memory.
Anyway, you need to tell us which lines are throwing errors and what the errors are.