CardSetKeyProperty function

This function is used to set the properties of a key.


DWORD WINAPI CardSetKeyProperty(
  _In_ PCARD_DATA      pCardData,
  _In_ LPCWSTR         pwszProperty,
  _In_ PBYTE           pbInput,
  _In_ DWORD           cbInput,
  _In_ DWORD           dwFlags


pCardData [in]

Context information for the call. For more information, see CardAcquireContext.

hKey [in]

The handle of the cryptographic key whose property is to be set.

pwszProperty [in]

A pointer to a null-terminated Unicode string that contains the name of the property to be set.

pbInput [in]

A byte pointer to data buffer that contains the property data.

cbInput [in]

The length, in bytes, of the data in the buffer to which pbInput points.

dwFlags [in]

A set of flags that specify options for the operation. Currently, no flags are defined. Set this value to 0.

Return value

Zero on success; nonzero on failure.


If dwFlags has a nonzero value, the function should return SCARD_E_INVALID_PARAMETER.

If pwszProperty contains an unsupported value, the function should return SCARD_E_INVALID_PARAMETER.

Note  Any minidriver may choose to define and support optional custom properties that are not defined in this specification.

The format of pbData depends on the value of the pwszProperty parameter. The following table describes the supported values for pwszProperty along with the corresponding format for pbData.

pwszProperty valuepbData typepbData value

The data contains a string that describes the type of chaining mode that the card should use for decryption. For more information, see the description of CP_CHAINING_MODES in CardGetProperty.


The data contains an initialization vector to be used for decryption.



Target platform



Cardmod.h (include Cardmod.h)



Send comments about this topic to Microsoft