Issue decrypting SMIME signed email (C# .NET)

The following Code

   String filename = "/tmp/SmimeSigned.msg";

    try {

        MailMessage mmOuter = MailMessage.load(filename);
        MailMessage decrypted = mmOuter.decrypt();
    } catch (Exception e) {
        System.out.println(e.toString());
        return;
    }

Fails with

class com.aspose.email.system.exceptions.CryptographicException: Cannot find factory provider for Bouncy Castle
com.aspose.email.internal.z.j.b(Unknown Source)
com.aspose.email.internal.z.j.a(Unknown Source)
com.aspose.email.internal.z.j.a(Unknown Source)
com.aspose.email.ank.a(SourceFile:52)
com.aspose.email.MailMessage.b(SourceFile:2736)
com.aspose.email.MailMessage.decrypt(SourceFile:2699)
com.csdisco.emailprocess.EmailProcessHandlerIT.repro_issue(EmailProcessHandlerIT.java:414)

When running on the following file

https://www.dropbox.com/s/b2wn114fncwmliz/SmimeSigned.msg?dl=0

Since by default I get a

java.lang.NoClassDefFoundError: org/bouncycastle/cms/CMSAttributeTableGenerator

I had added the folllowing 2 dependencies to my applicatoin
pom.xml

org.bouncycastle bcprov-jdk15on 1.61 org.bouncycastle bcmail-jdk15on 1.61

I just found that this solves the problem.
hopefully it can help other people

Security.addProvider(new BouncyCastleProvider());
MailMessage mmOuter = MailMessage.load(fileName);
MailMessage decrypted = mmOuter.decrypt();

@russ.nichols,

It’s good to know things are resolved on your end. Please feel free to share if there is any issue incurring on your end.