2 // System.Security.Cryptography CspParameters.cs
\r
5 // Thomas Neidhart (tome@sbox.tugraz.at)
\r
6 // Sebastien Pouliot <sebastien@ximian.com>
8 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Runtime.InteropServices;
32 using System.Security.AccessControl;
35 namespace System.Security.Cryptography {
\r
40 public sealed class CspParameters {
42 private CspProviderFlags _Flags;
\r
44 public CspParameters ()
49 public CspParameters (int dwTypeIn)
50 : this (dwTypeIn, null)
54 public CspParameters (int dwTypeIn, string strProviderNameIn)
55 : this (dwTypeIn, null, null)
59 public CspParameters (int dwTypeIn, string strProviderNameIn, string strContainerNameIn)
\r
61 ProviderType = dwTypeIn;
\r
62 ProviderName = strProviderNameIn;
\r
63 KeyContainerName = strContainerNameIn;
\r
65 // not defined in specs, only tested from M$ impl
\r
69 public string KeyContainerName;
\r
71 public int KeyNumber;
\r
73 public string ProviderName;
\r
75 public int ProviderType;
\r
77 public CspProviderFlags Flags {
\r
78 get { return _Flags; }
\r
79 set { _Flags = value; }
\r
83 private SecureString _password;
84 private IntPtr _windowHandle;
86 public CspParameters (int dwTypeIn, string strProviderNameIn, string strContainerNameIn,
87 CryptoKeySecurity cryptoKeySecurity, IntPtr parentWindowHandle)
88 : this (dwTypeIn, strProviderNameIn, strContainerNameIn)
90 if (cryptoKeySecurity != null)
91 CryptoKeySecurity = cryptoKeySecurity;
92 _windowHandle = parentWindowHandle;
95 public CspParameters (int dwTypeIn, string strProviderNameIn, string strContainerNameIn,
96 CryptoKeySecurity cryptoKeySecurity, SecureString keyPassword)
97 : this (dwTypeIn, strProviderNameIn, strContainerNameIn)
99 if (cryptoKeySecurity != null)
100 CryptoKeySecurity = cryptoKeySecurity;
101 _password = keyPassword;
104 [MonoTODO ("access control isn't implemented")]
105 public CryptoKeySecurity CryptoKeySecurity {
106 get { throw new NotImplementedException (); }
107 set { throw new NotImplementedException (); }
110 public SecureString KeyPassword {
111 get { return _password; }
112 set { _password = value; }
115 public IntPtr ParentWindowHandle {
116 get { return _windowHandle; }
117 set { _windowHandle = value; }