+2 votes

How do i encrypt and decrypt with beta .Net Core package. This seems to be missing or different.

THanks

by

1 Answer

0 votes

Please check out the latest package. Encryption is supported, however, with current state of .NET Core, signature validation can't be implemented.

by (301k points)
I installed the latest beta using nuget.

Does this no longer work?

 MailBuilder mailBldr = new MailBuilder();
            mailBldr.SMIMEConfiguration.DecryptAutomatically = false;
         mailBldr.SMIMEConfiguration.ExtractSignedAutomatically = false;
            IMail mail = mailBldr.CreateFromEml(msg);
            IMail decriptedMail = mail.Decrypt(decryptCert);
You won't find ExtractSignedAutomatically property in .net core version.
Do you plan on implementing signature verification in a future version.
As soon as SignedCms class is supported.
Then how are we suppose to use it? I cannot find IsEncrypted and NeedDecryption on IMail either. From where I am, I cannot decrypt messages using pfx certificates I have, body always return empty. Plus all documentation saying to do it one way and it doesn't work at all on .net core.
Decryption runs automatically if key is available in store.

IsEncrypted and NeedDecryption should be visible - there's something wrong with the package, we are checking it.
Thank you. That will help greatly, needless to say Decrypt etc is also missing from IMail, they are private on MimeDocument though. But one more question, I didn't test certificates stored on machine, since we only have secrets done in kubernetes, but why builder.SMIMEConfiguration.Certificates.AddRange(certificates); doesn't help with automatic decryption? I would expect it to have similar effect? Lastly, the versions between download and latest nuget are different. Is there schedule reason for it?
IMail.IsEncrypted, IMail.NeedDecryption, IMail.Decrypt, automatic decryption are fixed in the latest version (3.0.18165.2350).
Thank you very much. That was the fastest support resolution I ever experienced and it is working great. However, can you explain the problem with signed emails? The SignedCms was merged to core .net in December of last year. https://github.com/dotnet/corefx/issues/14197. Is there some particulars still not implemented there? We rely on email ingestion a lot. So knowing when our cross os platform app, will achieve full parity with windows counterpart, is crucial. Some ball park date will be so appreciated.
System.Security.Cryptography.Pkcs was released 16 days ago.
We'll try to incorporate it next week.
Tried the beta it is still not working, when trying to load from bytes mime signed email, it actually cannot even load regular fields it was able to load before, like sender or subject. I am talking about CreateFromEml method. Also as a result (maybe) NeedExtraction property is false. While on not netstandard it works great and populate all properties as well as NeedExtraction. If you still force it to decode manually, it tells you malformed. BTW it is all done like in the sample by disabling AutoExtract and verifying need for extraction and encrytption. Let me know if you need sample eml
Please contact us directly, along with the email (zipped) and code you are using - you can find our support email in the page footer.
...