Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2006-02-28 17:59:26 +0300
committerSebastien Pouliot <sebastien@ximian.com>2006-02-28 17:59:26 +0300
commitc08a2cd9b34b71221ca8fd0c0055c449331e6d21 (patch)
tree07fe06ec644e502148a6fdcfeb0e9d2bc606bc03 /mcs
parente5f26d3004bb4ed05558e2d4c81371661741e561 (diff)
2006-02-28 Sebastien Pouliot <sebastien@ximian.com>
* CryptoConvert.cs: Make sure we can import a keypair into our RSA instance (even if the key store isn't available). See bug #77559. * PKCS8.cs: Make sure we can import a keypair into our RSA instance (even if the key store isn't available). See bug #77559. svn path=/branches/mono-1-1-13/mcs/; revision=57392
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog7
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs38
-rw-r--r--mcs/class/Mono.Security/Mono.Security.Cryptography/PKCS8.cs18
3 files changed, 51 insertions, 12 deletions
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
index f4c50707dcc..3353d513a6e 100644
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-28 Sebastien Pouliot <sebastien@ximian.com>
+
+ * CryptoConvert.cs: Make sure we can import a keypair into our RSA
+ instance (even if the key store isn't available). See bug #77559.
+ * PKCS8.cs: Make sure we can import a keypair into our RSA instance
+ (even if the key store isn't available). See bug #77559.
+
2005-11-23 Sebastien Pouliot <sebastien@ximian.com>
* SymmetricTransform.cs: Synched with corlib version (IV behaviour for
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
index 1d876703f0c..e0e9cbd7ede 100644
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
@@ -5,11 +5,7 @@
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 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
@@ -166,8 +162,20 @@ namespace Mono.Security.Cryptography {
Array.Reverse (rsap.D);
}
- RSA rsa = (RSA)RSA.Create ();
- rsa.ImportParameters (rsap);
+ RSA rsa = null;
+ try {
+ rsa = RSA.Create ();
+ rsa.ImportParameters (rsap);
+ }
+ 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 (rsap);
+ }
return rsa;
}
catch (Exception e) {
@@ -287,8 +295,20 @@ namespace Mono.Security.Cryptography {
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
Array.Reverse (rsap.Modulus);
- RSA rsa = (RSA)RSA.Create ();
- rsa.ImportParameters (rsap);
+ RSA rsa = null;
+ try {
+ rsa = RSA.Create ();
+ rsa.ImportParameters (rsap);
+ }
+ 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 (rsap);
+ }
return rsa;
}
catch (Exception e) {
diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/PKCS8.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/PKCS8.cs
index d7cedf758f6..cc83e116844 100644
--- a/mcs/class/Mono.Security/Mono.Security.Cryptography/PKCS8.cs
+++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/PKCS8.cs
@@ -6,7 +6,7 @@
// Sebastien Pouliot <sebastien@ximian.com>
//
// (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 @@ namespace Mono.Security.Cryptography {
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;
}