CryptoServiceProvider Class |
Namespace: MailBee.Security
The CryptoServiceProvider type exposes the following members.
Name | Description | |
---|---|---|
CryptoServiceProvider |
Creates a new instance of CryptoServiceProvider class.
| |
CryptoServiceProvider(String) |
Creates a new instance of CryptoServiceProvider class.
|
Name | Description | |
---|---|---|
Dispose |
Releases the resources associated with the current CryptoServiceProvider object.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetKeyContainer |
Gets the name of the key container.
| |
GetProviderName |
Gets the name of the CSP represented by this object.
| |
GetProviderVersion |
Gets the version of the CSP represented by this object.
| |
GetSupportedAlgorithms |
Gets the array of all cryptographic algorithms supported by the CSP.
| |
GetSystemProviders |
Gets the list of all CPSs that are registered in the operating system.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Base |
Gets Microsoft Base Cryptographic Provider name.
| |
Enhanced |
Gets Microsoft Enhanced Cryptographic Provider name.
| |
Strong |
Gets Microsoft Strong Cryptographic Provider name.
|
Name | Description | |
---|---|---|
LastResult |
Gets a numeric code of the last error.
| |
ThrowExceptions |
Gets or sets whether the object will throw exceptions on errors.
|
Note |
---|
MailBee handles CSPs automatically. Usually there is no need to use CryptoServiceProvider class unless you need to use specific CSP. Although Smime class does offer Provider property, it's ignored by most editions of MailBee.NET Objects library. |
Note |
---|
UWP and .NET Standard 2.0+ editions don't support this class at all. With these editions, the class is not defined or has no public members. |
// To use the code below, import these namespace at the top of your code using System; using MailBee.Security; // The actual code (put it into a method of your class) Smime objSmime = new Smime(); // Use default CSP. Console.WriteLine(objSmime.Provider.GetProviderName()); Console.WriteLine(objSmime.Provider.GetProviderVersion()); Console.WriteLine(objSmime.Provider.GetKeyContainer()); Console.WriteLine("-----------------------------------"); // Set new default for CSP. objSmime.Provider = new CryptoServiceProvider(CryptoServiceProvider.Enhanced); // Use the new default CSP. Console.WriteLine(objSmime.Provider.GetProviderName()); Console.WriteLine(objSmime.Provider.GetProviderVersion()); Console.WriteLine(objSmime.Provider.GetKeyContainer()); Console.WriteLine("-----------------------------------"); // Set new default for CSP. CryptoServiceProvider strongProvider = new CryptoServiceProvider(CryptoServiceProvider.Strong); objSmime.Provider = strongProvider; // Use another CSP. Console.WriteLine(objSmime.Provider.GetProviderName()); Console.WriteLine(objSmime.Provider.GetProviderVersion()); Console.WriteLine(objSmime.Provider.GetKeyContainer()); Console.WriteLine("-----------------------------------");