OpenPGP Code Example: Encrypt with .asc key file
//.NET
Openpgp pgp = new Openpgp();
pgp.RecipientKeys.Add(new Key("..\\..\\files\\test@nsoftware.com-public.asc","test@nsoftware.com"));
pgp.ASCIIArmor = true;
pgp.InputMessage = "test";
pgp.Encrypt();
Console.WriteLine(pgp.OutputMessage);
//C++
int ret_code = 0;
char* output;
int len;
OpenPGP pgp;
pgp.SetRecipientKeyCount(1);
pgp.SetRecipientKeyKeyring(0,"..\\..\\files\\test@nsoftware.com-public.asc");
pgp.SetRecipientKeyUserId(0,"test@nsoftware.com");
pgp.SetASCIIArmor(true);
pgp.SetInputMessage("test",4);
ret_code = pgp.Encrypt();
pgp.GetOutputMessage(output,len);
printf(output);
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.