CryptoConfig::CreateFromName Method (String^, array<Object^>^)
Creates a new instance of the specified cryptographic object with the specified arguments.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- name
-
Type:
System::String^
The simple name of the cryptographic object of which to create an instance.
- args
-
Type:
array<System::Object^>^
The arguments used to create the specified cryptographic object.
| Exception | Condition |
|---|---|
| ArgumentNullException | The name parameter is null. |
| TargetInvocationException | The algorithm described by the name parameter was used with Federal Information Processing Standards (FIPS) mode enabled, but is not FIPS compatible. |
For a list of simple names recognized by this class, see CryptoConfig.
The following code example demonstrates how to call the CreateFromName method to initialize a new RSA provider instance accessing the TestContainer key container. This code example is part of a larger example provided for the CryptoConfig class.
CspParameters^ parameters = gcnew CspParameters; parameters->KeyContainerName = L"TestContainer"; array<Object^>^argsArray = gcnew array<Object^>(1){ parameters }; // Instantiate the RSA provider instance accessing the TestContainer // key container. RSACryptoServiceProvider^ rsaProvider = static_cast<RSACryptoServiceProvider^>( CryptoConfig::CreateFromName( L"RSA", argsArray ));
Available since 1.1