[Mono-bugs] [Bug 78175][Wis] New - Performance problems with RSA key generation in crypto classes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Apr 24 07:33:32 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by khe at kmd.dk.


--- shadow/78175	2006-04-24 07:33:32.000000000 -0400
+++ shadow/78175.tmp.961	2006-04-24 07:33:32.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 78175
+Product: Mono: Class Libraries
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Mono.Security
+AssignedTo: sebastien at ximian.com                            
+ReportedBy: khe at kmd.dk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Performance problems with RSA key generation in crypto classes
+Hi Sebastien
+Trying to use Mono.Security.dll (version 1.0.5) on a Microsoft platform 
+with .NET framework 1.1.
+I'm using the Mono classes: X509Certificate, PKCS12 and PKCS7
+As you already know, using the .NET framework methods/classes:
+- RSA.Create() or
+- new RSACryptoServiceProvider()
+always generate a key even though it is never needed.
+The mentioned Mono classes use the above quite often and this has a MAJOR 
+impact on the performance of the application. We are talking something 
+like a factor 15-20 on the assembly I'm working on.
+I know this is not a bug in Mono, but a design flaw in the Microsoft .NET 
+In my own code I have changed all my RSA.Create() and "new 
+RSACryptoServiceProvider()" to this:
+CspParameters cp = new CspParameters();
+cp.KeyContainerName = "myKeyContainer";
+cp.Flags = CspProviderFlags.UseMachineKeyStore;
+RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
+Apparently this prevents the framework from generating a key, so 
+performance is great.
+I have tried to "fix" as much in Mono as I could, by deriving from the 
+classes and making my own implementation of the problematic methods. Like 
+the RSA property in the X509Certificate class.
+But now I'm stuck at the PKCS12/PKCS8 class which simply is too complex to 
+just fix by overriding some methods that creates RSA objects.
+My question is:
+Since I can't control what's going on in Mono, is there ANY chance that 
+you can make a workaround in the Mono code for Mono.Security.dll builds 
+that are used in connection with the MS framework.
+I know it is not really your problem, but I really want to use Mono as 
+much as possible and as it is now, it totally cripples my application due 
+to very bad performance.
+I'm sure I'm not the only one with that problem.
+Any advice/help would be greatly appreciated.

More information about the mono-bugs mailing list