I have an issue decrypting the message. I created a certificate using the following command. makecert -sk Mynewkey -n "CN=TestCert" test.cer -ss my -pe
Error at this following line. mime.GetPart(1) is null. Error message with LastErrorText is : Failed to get MIME message part
Here is my decryption code.
asked Dec 10 '12 at 15:43
Look at the contents of the MIME after unwrapping the security layers (i.e. after calling UnwrapSecurity). Is the MIME multipart? If not, then obviously there are no sub-parts. If so, is there only 1 sub-part? The first sub-part is at index 0.
Also, make sure you understand the very basics of MIME -- such as: What is a multipart MIME message.
Also, to view the MIME, either save it to a file via the SaveMime method, or write it to a string via the GetMime method.
answered Dec 10 '12 at 15:50