diff options
-rw-r--r-- | mcs/class/System/System.Security.Cryptography.X509Certificates/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2.cs | 7 |
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; |