Author: spouliot
Date: 2006-12-11 15:37:25 -0500 (Mon, 11 Dec 2006)
New Revision: 69360
Modified:
trunk/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
trunk/mcs/class/corlib/Mono.Security.Cryptography/PKCS8.cs
Log:
2006-12-11 Sebastien Pouliot <[EMAIL PROTECTED]>
* PKCS8.cs: Synchronize source with Mono.Security.dll
Modified: trunk/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog 2006-12-11
20:35:58 UTC (rev 69359)
+++ trunk/mcs/class/corlib/Mono.Security.Cryptography/ChangeLog 2006-12-11
20:37:25 UTC (rev 69360)
@@ -1,3 +1,7 @@
+2006-12-11 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * PKCS8.cs: Synchronize source with Mono.Security.dll
+
2006-09-27 Sebastien Pouliot <[EMAIL PROTECTED]>
* RSAManaged.cs: Ensure that the results of Encrypt and Decrypt will
Modified: trunk/mcs/class/corlib/Mono.Security.Cryptography/PKCS8.cs
===================================================================
--- trunk/mcs/class/corlib/Mono.Security.Cryptography/PKCS8.cs 2006-12-11
20:35:58 UTC (rev 69359)
+++ trunk/mcs/class/corlib/Mono.Security.Cryptography/PKCS8.cs 2006-12-11
20:37:25 UTC (rev 69360)
@@ -6,7 +6,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com)
+// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -273,8 +273,20 @@
param.P = Normalize (privateKey [4].Value,
keysize2);
param.Q = Normalize (privateKey [5].Value,
keysize2);
- RSA rsa = RSA.Create ();
- rsa.ImportParameters (param);
+ RSA rsa = null;
+ try {
+ rsa = RSA.Create ();
+ rsa.ImportParameters (param);
+ }
+ catch (CryptographicException) {
+ // this may cause problem when this
code is run under
+ // the SYSTEM identity on Windows (e.g.
ASP.NET). See
+ //
http://bugzilla.ximian.com/show_bug.cgi?id=77559
+ CspParameters csp = new CspParameters
();
+ csp.Flags =
CspProviderFlags.UseMachineKeyStore;
+ rsa = new RSACryptoServiceProvider
(csp);
+ rsa.ImportParameters (param);
+ }
return rsa;
}
@@ -322,7 +334,7 @@
throw new CryptographicException
("invalid private key format");
// X is ALWAYS 20 bytes (no matter if the key
length is 512 or 1024 bits)
- dsaParameters.X = Normalize (privateKey, 20);
+ dsaParameters.X = Normalize (pvk.Value, 20);
DSA dsa = DSA.Create ();
dsa.ImportParameters (dsaParameters);
return dsa;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches