Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CryptoConfig::CreateFromName Method (String^, array<Object^>^)

 

Creates a new instance of the specified cryptographic object with the specified arguments.

Namespace:   System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

public:
static Object^ CreateFromName(
	String^ name,
	... array<Object^>^ args
)

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.

Return Value

Type: System::Object^

A new instance of 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 ));

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft