[docs] Import of Microsoft BCL Documentation.
[mono.git] / mcs / class / corlib / System.Security.Cryptography / CspParameters.cs
old mode 100755 (executable)
new mode 100644 (file)
index db5a592..0df9566
@@ -1,14 +1,11 @@
 //\r
-// System.Security.Cryptography CspParameters.cs\r
+// System.Security.Cryptography.CspParameters.cs\r
 //\r
-// Author:\r
-//   Thomas Neidhart (tome@sbox.tugraz.at)\r
+// Authors:\r
+//     Thomas Neidhart (tome@sbox.tugraz.at)\r
+//     Sebastien Pouliot  <sebastien@ximian.com>
 //\r
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 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
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-\r
-using System;\r
+
+using System.Runtime.InteropServices;
+using System.Security.AccessControl;
 \r
 namespace System.Security.Cryptography {\r
 \r
+       [ComVisible (true)]
        public sealed class CspParameters {
 \r
                private CspProviderFlags _Flags;\r
@@ -62,7 +61,7 @@ namespace System.Security.Cryptography {
                        // not defined in specs, only tested from M$ impl\r
                        KeyNumber = -1;\r
                }\r
-               \r
+\r
                public string KeyContainerName;\r
                \r
                public int KeyNumber;\r
@@ -74,6 +73,55 @@ namespace System.Security.Cryptography {
                public CspProviderFlags Flags {\r
                        get { return _Flags; }\r
                        set { _Flags = value; }\r
+               }
+
+               private SecureString _password;
+               private IntPtr _windowHandle;
+
+               public CspParameters (int providerType, string providerName, string keyContainerName, 
+                       CryptoKeySecurity cryptoKeySecurity, IntPtr parentWindowHandle)
+                       : this (providerType, providerName, keyContainerName)
+               {
+                       if (cryptoKeySecurity != null)
+                               CryptoKeySecurity = cryptoKeySecurity;
+                       _windowHandle = parentWindowHandle;
+               }
+
+               public CspParameters (int providerType, string providerName, string keyContainerName, 
+                       CryptoKeySecurity cryptoKeySecurity, SecureString keyPassword)
+                       : this (providerType, providerName, keyContainerName)
+               {
+                       if (cryptoKeySecurity != null)
+                               CryptoKeySecurity = cryptoKeySecurity;
+                       _password = keyPassword;
                }\r
+\r
+               internal CspParameters(CspParameters parameters)\r
+                       : this(parameters.ProviderType, parameters.ProviderName, parameters.KeyContainerName)\r
+               {\r
+                       if (parameters.CryptoKeySecurity != null)\r
+                               CryptoKeySecurity = parameters.CryptoKeySecurity;\r
+\r
+                       _Flags = parameters.Flags;\r
+                       KeyNumber = parameters.KeyNumber;\r
+                       _password = parameters.KeyPassword;\r
+                       _windowHandle = parameters.ParentWindowHandle;\r
+               }\r
+
+               [MonoTODO ("access control isn't implemented")]
+               public CryptoKeySecurity CryptoKeySecurity {
+                       get { throw new NotImplementedException (); }
+                       set { throw new NotImplementedException (); }
+               }
+
+               public SecureString KeyPassword {
+                       get { return _password; }
+                       set { _password = value; }
+               }
+
+               public IntPtr ParentWindowHandle {
+                       get { return _windowHandle; }
+                       set { _windowHandle = value; }
+               }
        }\r
 }\r