IX509PrivateKey::put_ProviderType method (certenroll.h)

The ProviderType property specifies or retrieves the type of cryptographic provider associated with the private key. This property is web enabled for both input and output.

This property is read/write.

Syntax

HRESULT put_ProviderType(
  X509ProviderType Value
);

Parameters

Value

Return value

None

Remarks

You can use this property to force the use of the default provider for a given provider type. For example, to use the PROV_RSA_SCHANNEL provider, set this property to the XCN_PROV_RSA_SCHANNELX509ProviderType enumeration value and do not specify a value for the ProviderName property.

Setting this property automatically sets the following properties to be consistent with the specified ProviderType value:

These properties are set in the following manner:
  • If the ProviderType is set to XCN_PROV_NONE:
    • The LegacyCsp property is set to VARIANT_FALSE.
    • The KeySpec property is set to XCN_AT_NONE.
  • If the ProviderType is not set to XCN_PROV_NONE:
    • The LegacyCsp property is set to VARIANT_TRUE.
    • The KeySpec property is set to XCN_AT_SIGNATURE if the current value is XCN_AT_NONE.
Because a previously specified ProviderName is not affected by setting the ProviderType property, setting a ProviderType that is inconsistent with the ProviderName property will result in undefined behavior, likely a failure when creating or opening a private key. We recommend that you set the ProviderType property only when attempting to force the use of the default provider for the specified type as discussed above.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header certenroll.h
DLL CertEnroll.dll

See also

IX509PrivateKey