I'm sending mails to users with attachments. Mails that aren't signed, get a .pdf file (around 64kb) and are working perfectly fine.
However, when I sign them for other users, the PDF file becomes around 64 B and can't be opened.
I'm not doing anything with the attachments while signing, however.. so this is very odd.
My code for signing:
email = SpecificMethods.DKIMSign(email);
internal static MailMessage DKIMSign(MailMessage email)
{
var privateKey = PrivateKeySigner.Create(@"-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----");
var domainKeySigner = new DomainKeySigner(privateKey, "***.com", "**", new string[] { "mime-version", "date", "subject", "from", "to", "content-type" });
email.DomainKeySign(domainKeySigner);
var dkimSigner = new DkimSigner(privateKey, "***.com", "**", new string[] { "mime-version", "date", "subject", "from", "to", "content-type" });
email.DkimSign(dkimSigner);
return email;
}
And eventually send it. Nothing special happening there.
Any reason why my attachment would 'break'??