mscorlib(4.0.0.0) API with additions
CspParameters.cs
3 
5 {
7  [ComVisible(true)]
8  public sealed class CspParameters
9  {
11  public int ProviderType;
12 
14  public string ProviderName;
15 
17  public string KeyContainerName;
18 
20  public int KeyNumber;
21 
22  private int m_flags;
23 
24  private CryptoKeySecurity m_cryptoKeySecurity;
25 
26  private SecureString m_keyPassword;
27 
28  private IntPtr m_parentWindowHandle;
29 
33  public CspProviderFlags Flags
34  {
35  get
36  {
37  return (CspProviderFlags)m_flags;
38  }
39  set
40  {
41  int num = 255;
42  if (((int)value & ~num) != 0)
43  {
44  throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)value), "value");
45  }
46  m_flags = (int)value;
47  }
48  }
49 
53  {
54  get
55  {
56  return m_cryptoKeySecurity;
57  }
58  set
59  {
60  m_cryptoKeySecurity = value;
61  }
62  }
63 
67  {
68  get
69  {
70  return m_keyPassword;
71  }
72  set
73  {
74  m_keyPassword = value;
75  m_parentWindowHandle = IntPtr.Zero;
76  }
77  }
78 
82  {
83  get
84  {
85  return m_parentWindowHandle;
86  }
87  set
88  {
89  m_parentWindowHandle = value;
90  m_keyPassword = null;
91  }
92  }
93 
95  public CspParameters()
96  : this(24, null, null)
97  {
98  }
99 
102  public CspParameters(int dwTypeIn)
103  : this(dwTypeIn, null, null)
104  {
105  }
106 
110  public CspParameters(int dwTypeIn, string strProviderNameIn)
111  : this(dwTypeIn, strProviderNameIn, null)
112  {
113  }
114 
119  public CspParameters(int dwTypeIn, string strProviderNameIn, string strContainerNameIn)
120  : this(dwTypeIn, strProviderNameIn, strContainerNameIn, CspProviderFlags.NoFlags)
121  {
122  }
123 
130  public CspParameters(int providerType, string providerName, string keyContainerName, CryptoKeySecurity cryptoKeySecurity, SecureString keyPassword)
131  : this(providerType, providerName, keyContainerName)
132  {
133  m_cryptoKeySecurity = cryptoKeySecurity;
134  m_keyPassword = keyPassword;
135  }
136 
143  public CspParameters(int providerType, string providerName, string keyContainerName, CryptoKeySecurity cryptoKeySecurity, IntPtr parentWindowHandle)
144  : this(providerType, providerName, keyContainerName)
145  {
146  m_cryptoKeySecurity = cryptoKeySecurity;
147  m_parentWindowHandle = parentWindowHandle;
148  }
149 
150  internal CspParameters(int providerType, string providerName, string keyContainerName, CspProviderFlags flags)
151  {
152  ProviderType = providerType;
153  ProviderName = providerName;
154  KeyContainerName = keyContainerName;
155  KeyNumber = -1;
156  Flags = flags;
157  }
158 
159  internal CspParameters(CspParameters parameters)
160  {
161  ProviderType = parameters.ProviderType;
162  ProviderName = parameters.ProviderName;
163  KeyContainerName = parameters.KeyContainerName;
164  KeyNumber = parameters.KeyNumber;
165  Flags = parameters.Flags;
166  m_cryptoKeySecurity = parameters.m_cryptoKeySecurity;
167  m_keyPassword = parameters.m_keyPassword;
168  m_parentWindowHandle = parameters.m_parentWindowHandle;
169  }
170  }
171 }
IntPtr ParentWindowHandle
Gets or sets a handle to the unmanaged parent window for a smart card password dialog box.
int KeyNumber
Specifies whether an asymmetric key is created as a signature key or an exchange key.
string KeyContainerName
Represents the key container name for T:System.Security.Cryptography.CspParameters.
Definition: __Canon.cs:3
CspProviderFlags
Specifies flags that modify the behavior of the cryptographic service providers (CSP).
string ProviderName
Represents the provider name for T:System.Security.Cryptography.CspParameters.
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
CspParameters(int dwTypeIn, string strProviderNameIn, string strContainerNameIn)
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class with the specifi...
Represents text that should be kept confidential, such as by deleting it from computer memory when no...
Definition: SecureString.cs:11
A platform-specific type that is used to represent a pointer or a handle.
Definition: IntPtr.cs:14
CspParameters(int dwTypeIn, string strProviderNameIn)
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class with the specifi...
Contains parameters that are passed to the cryptographic service provider (CSP) that performs cryptog...
Definition: CspParameters.cs:8
CspParameters(int providerType, string providerName, string keyContainerName, CryptoKeySecurity cryptoKeySecurity, IntPtr parentWindowHandle)
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class using a provider...
The exception that is thrown when one of the arguments provided to a method is not valid.
KeyNumber
Specifies whether to create an asymmetric signature key or an asymmetric exchange key.
Definition: KeyNumber.cs:8
CspParameters(int providerType, string providerName, string keyContainerName, CryptoKeySecurity cryptoKeySecurity, SecureString keyPassword)
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class using a provider...
static readonly IntPtr Zero
A read-only field that represents a pointer or handle that has been initialized to zero.
Definition: IntPtr.cs:20
SecureString KeyPassword
Gets or sets a password associated with a smart card key.
Provides the ability to control access to a cryptographic key object without direct manipulation of a...
int ProviderType
Represents the provider type code for T:System.Security.Cryptography.CspParameters.
CspParameters()
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class.
CspParameters(int dwTypeIn)
Initializes a new instance of the T:System.Security.Cryptography.CspParameters class with the specifi...
CspProviderFlags Flags
Represents the flags for T:System.Security.Cryptography.CspParameters that modify the behavior of the...