I have 2 emails (my and other). For both I have a .pfx file and a .cer file.
I succeed in sending a signed and encrypted mail:
CkMailMan mailman;
//...
auto email = std::make_unique<CkEmail>();
email->put_SendSigned(true);
mailman.AddPfxSourceFile("my.pfx", "mypass");
auto cert = std::make_unique<CkCert>();
cert->LoadFromFile("other.cer");
email->put_SendEncrypted(true);
email->put_Pkcs7CryptAlg("3des");
email->put_Pkcs7KeyLength(192);
success = email->SetEncryptCert(*cert);
mailman.put_OpaqueSigning(true);
// ...
mailman.SendEmail(*email);
But if I try to decrypt this mail in the other account:
CkImap imap;
//...
CkMessageSet* messageSet = imap.Search("ALL",true);
CkEmailBundle* bundle = imap.FetchHeaders(*messageSet);
for (int i = 0; i < bundle->get_MessageCount(); i++) {
CkEmail* email = bundle->GetEmail(i);
email->AddPfxSourceFile("other.pfx", "otherpass");
if (email->get_ReceivedEncrypted() == true)
if (email->get_Decrypted() == true)
Ok();
delete email;
}
I never reach ok (email->get_ReceivedEncrypted() returns always false).
Any idea what's wrong here?