0

I am using Exchange Web Services (EWS) to read emails and their attachments. I was successful until I started receiving some emails that were digitally signed. I found this link EWS: Retrieving attachments from signed emails where the solution starts off by saying "... Assuming your security context has access to the key. " which is exactly where it seems I have problem. How can I make sure my security context has access to the key? How do I achieve that? The code in the above link gives me an error: ASN1 bad tag value met

Community
  • 1
  • 1
Dogahe
  • 1,380
  • 2
  • 20
  • 50

1 Answers1

0

Are the messages signed or Encrypted (or both) ? To decrypt an encrypted message you would need to have the Private Key (eg for SMIME these should have been exchanged) the EnvelopedCms will search current user (security context) and computer certificate store for this certificate information. However in Exchange in addition to being stored locally the certificate that could be used to decrypt the message could be stored as an attachment on a Personal Contact or in Active Directory http://blogs.technet.com/b/exchange/archive/2008/04/23/3405402.aspx.

Glen Scales
  • 20,495
  • 1
  • 20
  • 23
  • It's only signed, I am using these lines of code 1.Dim signed As SignedCms = New SignedCms 2.signed.Decode(filebyte) 3. Dim unsignedRawMimeEntity As Byte() = signed.ContentInfo.Content And I get "ASN1 bad tag value met" error on line 2. – Dogahe Jan 08 '16 at 18:12