Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling SignedCMS.Decode takes too long

Is there any reason that calling SignedCMS.Decode would take 15 seconds or more? I have the following code:

SignedCms signedCms = new SignedCms();
signedCms.Decode(postedData);

where postedData is a byte array of a signed CMS message. Sometimes the function call returns instantly, but most of the time, it takes 10-15 seconds to return causing the message sender to timeout.

This seems to happen whether or not the debugger is attached to the process.

like image 385
user1256111 Avatar asked May 09 '26 09:05

user1256111


1 Answers

So I narrowed it down to an instantiation of Oid in one of the functions that the Decode function calls. The source is available at Reference Source .NET Framework 4.5.1.

I tested using:

System.Security.Cryptography.Oid oid = new System.Security.Cryptography.Oid("1.2.840.113549.1.7.1");

I also found this link with a similar problem.

Interestingly, disconnecting my wireless adapter, the Oid instantiation occurs immediately, which leads me to believe that it may be network/DNS related (I have not idea what the Oid instantiation is doing). After reconnecting my adapter SignedCms.Decode is working as normal. Another option I read is to remove my computer from the domain and then rejoin. Haven't tried it yet.

Maybe this will help anyone else that is have the same (or similar) problem.

like image 154
user1256111 Avatar answered May 10 '26 21:05

user1256111