none
EnvelopedCms constructor delay RRS feed

  • Question

  • Hi,

    I want to decrypt PKCS7 encrypted envelope in .NET. Here's my code:

    public static string DecryptMessage(string message)
    {
    byte[] encodedEnvelopedCms = PemStringToCms(message);
    EnvelopedCms envelopedCms = new EnvelopedCms();
    envelopedCms.Decode(encodedEnvelopedCms);
    X509Certificate2Collection certCollection = new X509Certificate2Collection(MyX509CertColl);
    envelopedCms.Decrypt(certCollection);
    UnicodeEncoding unicode = new UnicodeEncoding();
    return unicode.GetString(envelopedCms.ContentInfo.Content);
    }

    Everything works fine except the situation when it takes too long for DNS server to respond (e.g. when DNS server set in network properties is not available). I discovered that critical is the line with EnvelopedCms constructor, i.e.:

    EnvelopedCms envelopedCms = new EnvelopedCms();

    I've already found similar problem in KB948080 but the given resolution is not applicable in my situation because I don't have any way to choose default hashing algorithm for EnvelopedCms object...

    Does anyone of you (or maybe someone from MSFT) know if there's any progress with KB948080 and similar problems? Does anyone have any idea how can I overcome this problem in my situation? Thanks in advance for any ideas!

    Regards,

    Pawel

     

     

    Thursday, April 15, 2010 1:48 PM