CardGetProperty function
The CardGetProperty function is modeled after the query functions of CAPI for keys. It takes a LPWSTR that indicates which parameter is being requested. The function returns data in the pbData parameter.
Syntax
DWORD WINAPI CardGetProperty(
_In_ PCARD_DATA pCardData,
_In_ LPWSTR wszProperty,
_Out_opt_ PBYTE pbData,
_In_ DWORD cbData,
_Out_ PDWORD pdwDataLen,
_In_ DWORD dwFlags
);
Parameters
pCardData [in]
Context information for the call. For more information, see CardAcquireContext.wszProperty [in]
The name of the requested property.pbData [out, optional]
Byte pointer to data buffer to receive the data.cbData [in]
Length of input the buffer.pdwDataLen [out]
Pointer to a DWORD value receiving the actual data length.dwFlags [in]
Flags for the operation.
Return value
Zero on success; nonzero on failure.
Remarks
CardGetProperty should check the dwFlags value. Unless dwFlags is specified for the property and the value is nonzero, it should fail and return SCARD_E_INVALID_PARAMETER.
If an unsupported wszProperty is passed to CardGetProperty, it should fail and return SCARD_E_INVALID_PARAMETER or SCARD_E_UNSUPPORTED_FEATURE. Implementing all the following properties is mandatory unless explicitly stated otherwise. Any minidriver can choose to define and support optional custom properties that are not defined in this specification.
If cbData is less than the length of the buffer that is to be returned, CardGetProperty should return ERROR_INSUFFICIENT_BUFFER.
Note Careful attention must be taken when returning CP_READ_ONLY_CARD as true. When this property is returned as true, all write operations to the card are blocked at the Base CSP layer.
The format of pbData is different depending on the wszProperty parameter that is passed to the function.
The following table is a list of the different types that pbData takes depending on wszProperty (the structures are serialized as byte arrays).
wszProperty | pbData type | pbData value |
---|---|---|
CP_CARD_FREE_SPACE |
|
|
CP_CARD_CAPABILITIES |
|
|
CP_CARD_KEYSIZES |
The dwFlags parameter indicates key type to be queried. This is one of the AT_* defined values, such as AT_SIGNATURE or AT_ECDSA_P256.
A card minidriver that supports read-only cards may support more key types than what the specific read only card has been provisioned with. In this case the call may succeed and return a corresponding CARD_KEY_SIZES structure for the supported key spec. |
|
CP_CARD_READ_ONLY |
BOOL | If True, all write operations are blocked at the Base CSP layer. This flag also affects the data cache. If the card indicates that it is read-only, the Base CSP/KSP does not write to the cardcf file. |
CP_CARD_CACHE_MODE |
DWORD |
|
CP_SUPPORTS_WIN_X509_ENROLLMENT |
BOOL | Indicates whether Windows PKI should be allowed to write or renew certificates on the card. This should be used to avoid unexpected results because of a lack of support for multiple PINs in Windows PKI enrollment client. |
CP_CARD_GUID |
BYTE[] | In this situation, pbData is a buffer that contains a unique GUID for the card. This value must exactly match the GUID in the “cardid” file. |
CP_CARD_SERIAL_NO |
BYTE[] | In this situation, pbData is a buffer that contains a serial number for the card. The format of the serial number is opaque to the Base CSP and is intended for other applications that query the card minidriver directly. This is an optional property that may be supported by the card. |
CP_CARD_PIN_INFO |
PIN_INFO | In this situation, pbData is a PIN_INFO structure that contains information about the PIN. The dwFlags parameter contains the identifier of the PIN to return. |
CP_CARD_LIST_PINS |
PIN_SET | In this situation, pbData contains a PIN_SET that indicates by a bit-mask what entities the card currently uses. |
CP_CARD_AUTHENTICATED_STATE |
PIN_SET | In this situation, pbData contains a PIN_SET that indicates by a bit-mask what entities the card currently authenticates. This is an optional property that may be supported by the card. |
CP_CARD_PIN_STRENGTH_VERIFY |
In this situation, pbData contains a bitmask of one or more of the following values:
The following points apply to PIN strength:
|
|
CP_KEY_IMPORT_SUPPORT |
DWORD | In this situation, pbData is a DWORD value. This value is a bitmask that describes the types of key import which the card supports.
|
CP_ENUM_ALGORITHMS |
LPWSTR | In this situation, pbData contains a multistring value that describes the algorithms that the minidriver supports. The dwFlags parameter for this operation should contain one of the following values that define the type of algorithm enumeration to perform:
This property is defined in version 7 and later versions of this specification. Note This property is read-only. 3DES_112 is for the situation in which the first and third keys are the same. |
CP_PADDING_SCHEMES |
DWORD | In this situation, pbData contains a DWORD value. This value is a bitmask that describes the types of padding that the card supports for RSA cryptographic operations. The dwFlags parameter controls the cipher operation to which the query pertains. For more information, see the CP_ENUM_ALGORITHMS property value that was previously described. For asymmetric keys, the return type contains the bitmask with the following padding schemes:
For symmetric keys, only one flag is defined that indicates whether the message was padded up to the next block size. If the message is a multiple of the block size, no padding is needed:
This property is defined in version 7 and later versions of this specification. Note This property is read-only. For symmetric key padding, only support for PKCS#5 padding will exist. |
CP_CHAINING_MODES |
LPWSTR | In this situation, pbData contains a multistring value that describes the types of chaining modes that the card supports for symmetric key operations. Currently, the only supported chaining mode is cipher block chaining (CBC):
|
Requirements
Target platform |
Desktop |
Header |
Cardmod.h (include Cardmod.h) |