IX509PrivateKey::LegacyCsp property

The LegacyCsp property specifies or retrieves a Boolean value that indicates whether the provider is a CryptoAPI (legacy) cryptographic service provider (CSP). This property is web enabled for both input and output.

This property is read/write.


HRESULT put_LegacyCsp(
  [in]  VARIANT_BOOL Value

HRESULT get_LegacyCsp(
  [out] VARIANT_BOOL *pValue

Property value

A VARIANT_BOOL variable. A value of VARIANT_TRUE indicates that the provider is a legacy CSP. The default value is VARIANT_TRUE.

Error codes

If the function succeeds, the function returns S_OK.

If the function fails, it returns an HRESULT value that indicates the error. Possible values include, but are not limited to, those in the following table. For a list of common error codes, see Common HRESULT Values.


The key is open, and the property value cannot be set.


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

These properties are set in the following manner:

  • If the LegacyCsp property is set to VARIANT_FALSE:
  • If the LegacyCsp property is set to VARIANT_TRUE:
    • The ProviderType is set to XCN_PROV_RSA_FULL if the current value is XCN_PROV_NONE.
    • The KeySpec property is set to XCN_AT_SIGNATURE if the current property is XCN_AT_NONE.

Because a previously specified ProviderName is not affected by setting the LegacyCsp property, setting a LegacyCsp that is inconsistent with the ProviderName property will result in undefined behavior, likely a failure when creating or opening a private key.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]





See also




Community Additions