|
Hi, We use XML and Secured Mail messages to communicate with a third party. the XML message is included in the mail message as an AlternateView, and the MailMessage gets signed with an SHA256 hash algorithm. The problems we are facing now, is a performance issue. It takes everywhere from 5 seconds till 90 seconds to sign a single message. and I have no clue why this is. I would certainly like some pointers where to start searching for this issue. Thanks for any advice! |
|
5 to 90 seconds is obviously very long. Unless the messages you are signing are extremely large, the Sign method should be very quick. We need to determine which operation is actually causing the slowdown. Does this only happen with SHA-256, or have you tried other algorithms as well? To determine how long the actual signing operation takes, please try running the following code using the same certificate you pass to Sign method:
Does this work, and how long does it take? Then, try the following code:
This does the same thing, but it converts RebexCertificate to .NET certificate and uses RSACryptoServiceProvider object to sign the data. Is this similarly slow? I've modified the code a little bit (we use Vb.Net, and in stead of a console app, I made it a webservice, to simulate the normal processing). It works. Average time it takes on my local machine (Win7 + ASP.NET Dev webserver) is a few miliseconds. Average time it takes on the "slow" server (Win2k3 + SP2 + IIS v6.0) is a few seconds.. I'm starting to think it has something to do with the machine itself.. Any further hints?
(22 Mar '11, 14:31)
Eric van der...
This might be some CryptoAPI related issue. Even few seconds sounds like a way too much, although it's not as bad as 90 seconds you reported with MailMessage (which uses a code equivalent to the one I posted). Which part of the code actually causes the slowdown? Is it the SignHash method or something else?
(25 Mar '11, 08:56)
Lukas Pokorny ♦♦
|
|
Sorry for the delay, apparently I did not get any notification there was a new message. Yes, the slowdown is in the signhash method. A few seconds is the average time it takes to sign even this small message, Only when we stress the machine will the process time climb to the 90 seconds I reported. I would be gratefull for any help, since this is a subject I'm not (yet) intimatly familliar with. Regards, Eric I added another variant of the test code to my original answer above. It does the same operation using .NET classes. Please give it a try and let me know whether it's slow as well. (By the way, we have recently changed the forum software and notification should work now.)
(04 May '11, 18:55)
Lukas Pokorny ♦♦
|