[System]: Implement X509Certificate2.Export(X509ContentType.Pfx).
[mono.git] / mcs / class / Mono.Security / Mono.Security.X509 / PKCS12.cs
index 62ed9c7a3fc404104b19f30d9802fdc053eaf14c..fc8ac2bb306ec90519e2c0e4da4afd84d6a90bd1 100644 (file)
@@ -430,6 +430,10 @@ namespace Mono.Security.X509 {
 
                public string Password {
                        set {
+                               // Clear old password.
+                               if (_password != null)
+                                       Array.Clear (_password, 0, _password.Length);
+                               _password = null;
                                if (value != null) {
                                        if (value.Length > 0) {
                                                int size = value.Length;
@@ -447,9 +451,6 @@ namespace Mono.Security.X509 {
                                                // double-byte (Unicode) NULL (0x00) - see bug #79617
                                                _password = new byte[2];
                                        }
-                               } else {
-                                       // no password
-                                       _password = null;
                                }
                        }
                }