P
PV
I have found that RSACryptoServiceProvider.VerifyData sometimes hangs for
several (typically 6 or more) seconds. This is very irritating since a
component that I am using makes this call every time a form in my
application opens. The entire application freezes. Obviously it makes my
application very sluggish.
Mind you, on some machines the above always seems to be very quick. And on
others it can be quick for several minutes, and then start hanging for a
while.
I'm using .Net Framework 2.0. Here is some sample code from my very basic
"hello world" application, followed by the trace output (generated using
Enterprise Library)...
public static void Trace(string message)
{
Logger.Write(message, "Trace", 0, 0,
TraceEventType.Information);
}
private RSACryptoServiceProvider encryptionService = new
RSACryptoServiceProvider();
private string publicKey = [I have an approximately 340 character
xml formatted string here]
private string xmlData = [I have an approximately 470 character xml
formatted string here]
private string Signature = [I have an approximately 200 character
base 64 encoded string here]
private void button1_Click(object sender, EventArgs e)
{
Trace("Before encryptionService.FromXmlString");
encryptionService.FromXmlString(publicKey);
Trace("After
LicenseProviderBase.EncryptionService.FromXmlString");
Trace("Before encryptionService.VerifyData");
bool result =
encryptionService.VerifyData(Encoding.UTF8.GetBytes(this.xmlData),
new SHA1Managed(),
Convert.FromBase64String(this.Signature));
Trace("After encryptionService.VerifyData");
}
----------------------------------------
Timestamp: 6/29/2006 4:54:07 PM
Message: Before encryptionService.FromXmlString
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:08 PM
Message: After LicenseProviderBase.EncryptionService.FromXmlString
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:08 PM
Message: Before encryptionService.VerifyData
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:14 PM
Message: After encryptionService.VerifyData
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
several (typically 6 or more) seconds. This is very irritating since a
component that I am using makes this call every time a form in my
application opens. The entire application freezes. Obviously it makes my
application very sluggish.
Mind you, on some machines the above always seems to be very quick. And on
others it can be quick for several minutes, and then start hanging for a
while.
I'm using .Net Framework 2.0. Here is some sample code from my very basic
"hello world" application, followed by the trace output (generated using
Enterprise Library)...
public static void Trace(string message)
{
Logger.Write(message, "Trace", 0, 0,
TraceEventType.Information);
}
private RSACryptoServiceProvider encryptionService = new
RSACryptoServiceProvider();
private string publicKey = [I have an approximately 340 character
xml formatted string here]
private string xmlData = [I have an approximately 470 character xml
formatted string here]
private string Signature = [I have an approximately 200 character
base 64 encoded string here]
private void button1_Click(object sender, EventArgs e)
{
Trace("Before encryptionService.FromXmlString");
encryptionService.FromXmlString(publicKey);
Trace("After
LicenseProviderBase.EncryptionService.FromXmlString");
Trace("Before encryptionService.VerifyData");
bool result =
encryptionService.VerifyData(Encoding.UTF8.GetBytes(this.xmlData),
new SHA1Managed(),
Convert.FromBase64String(this.Signature));
Trace("After encryptionService.VerifyData");
}
----------------------------------------
Timestamp: 6/29/2006 4:54:07 PM
Message: Before encryptionService.FromXmlString
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:08 PM
Message: After LicenseProviderBase.EncryptionService.FromXmlString
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:08 PM
Message: Before encryptionService.VerifyData
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------
----------------------------------------
Timestamp: 6/29/2006 4:54:14 PM
Message: After encryptionService.VerifyData
Category: Trace
Priority: 0
EventId: 0
Severity: Information
Title:
Machine: CHL0130
Application Domain: HelloWorld.exe
Process Id: 3056
Process Name: C:\Program Files\HelloWorld\HelloWorld.exe
Win32 Thread Id: 3876
Thread Name:
Extended Properties:
----------------------------------------