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
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2008-06-03 17:18:46 +0400
committerSebastien Pouliot <sebastien@ximian.com>2008-06-03 17:18:46 +0400
commit8b9874b462f88cea26b52aa20048bd13a4d88574 (patch)
tree47e1f253639b94664391ca1a037f0e0856a9a5cf /mcs/class/System/System.Security.Cryptography.X509Certificates
parent479e05c4a2fdebf3259e4bb32e8c9d61ddcc20fe (diff)
2008-06-03 Sebastien Pouliot <sebastien@ximian.com>
* X509Certificate2.cs: Allow PrivateKey property to be set to null. [Fix bug #396620] svn path=/trunk/mcs/; revision=104752
Diffstat (limited to 'mcs/class/System/System.Security.Cryptography.X509Certificates')
-rw-r--r--mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog5
-rw-r--r--mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs7
2 files changed, 11 insertions, 1 deletions
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
index 392aa0c5490..5d37834791c 100644
--- a/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-03 Sebastien Pouliot <sebastien@ximian.com>
+
+ * X509Certificate2.cs: Allow PrivateKey property to be set to null.
+ [Fix bug #396620]
+
2008-05-18 Sebastien Pouliot <sebastien@ximian.com>
* X509Chain.cs: Use String.IsNullOrEmpty inside 2.0 code.
diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs
index 66ac6ac3b0c..bb588d41cb9 100644
--- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs
+++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs
@@ -223,7 +223,12 @@ namespace System.Security.Cryptography.X509Certificates {
if (_cert == null)
throw new CryptographicException (empty_error);
- if (value is RSA)
+ // allow NULL so we can "forget" the key associated to the certificate
+ // e.g. in case we want to export it in another format (see bug #396620)
+ if (value == null) {
+ _cert.RSA = null;
+ _cert.DSA = null;
+ } else if (value is RSA)
_cert.RSA = (RSA) value;
else if (value is DSA)
_cert.DSA = (DSA) value;