user2216394
user2216394

Reputation: 1

Read email S/MIME and attachments p7s

I have an e-mail S / MIME key p7s should read the attachment postacert.eml but this is not one of my attachments, why?

It is found in the case smime.p7s?

Why I can not decrypt it with this code?

                             byte[] VetByte = File.ReadAllBytes("smime.p7s");
                                var cmsMessage = new SignedCms();
                                cmsMessage.Decode(VetByte);
                                ContentInfo ci = cmsMessage.ContentInfo;
                                File.WriteAllBytes("pippo.txt",ci.Content);

Why pippo.txt is empty?

Sorry I forgot to say that I use the library for read email http://hpop.sourceforge.net/

Thanks :-)

Upvotes: 0

Views: 3105

Answers (1)

jstedfast
jstedfast

Reputation: 38593

An smime.p7s file is a detached digital signature that is used for verifying that the other parts within the message are from who it claims to be from and has not been tampered with.

There is no human readable content within an smime.p7s attachment.

If you end up needing to do more with S/MIME at some point (like verifying digital signatures, decrypting encrypted messages, etc), I would suggest taking a look at MimeKit and MailKit (both are free and Open Source).

Upvotes: 2

Related Questions