I have implemented OpenPGP encryption on a c# console application that sends out a PGP encrypted email, using MimeKit and Gpg4win. I have the console app running fine, but when I implement this for a Website running in IIS the public keys are not found. I receive an error like this:
MimeKit.Cryptography.PublicKeyNotFoundException: The public key could not be found.
at MimeKit.Cryptography.OpenPgpContext.GetPublicKey(MailboxAddress mailbox)
at MimeKit.Cryptography.OpenPgpContext.GetPublicKeys(IEnumerable`1 mailboxes)
at MimeKit.Cryptography.OpenPgpContext.Encrypt(IEnumerable`1 recipients, Stream content)
at MimeKit.Cryptography.MultipartEncrypted.Create(OpenPgpContext ctx, IEnumerable`1 recipients, MimeEntity entity)
I'm pretty sure this is only working in my console app because I'm running it under my User profile, and Gpg4win has my public keys stored under my profile application data i.e. in C:\Documents and Settings\me\Application Data\gnupg\
How can I allow my website, which is running under a specific app pool profile, to access these keys?
Thanks in advance