CardGetContainerInfo function

The CardGetContainerInfo function queries the specified key container for more information about which keys are present, such as its key specification (such as AT_ECDSA_P384).


DWORD WINAPI CardGetContainerInfo(
  _In_    PCARD_DATA      pCardData,
  _In_    BYTE            bContainerIndex,
  _In_    DWORD           dwFlags,
  _Inout_ PCONTAINER_INFO pContainerInfo


pCardData [in]

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

bContainerIndex [in]

The index for the container, which the Base CSP/KSP assigns.

dwFlags [in]

Reserved. Set to 0.

pContainerInfo [in, out]

Pointer to a CONTAINER_INFO structure that the caller supplies and that the card minidriver fills.

Return value

Zero on success; otherwise, nonzero.


CardGetContainerInfo allocates memory that the caller must free by calling PFN_CSP_FREE.

The container information is returned in the following structure.


typedef struct _CONTAINER_INFO
    IN OUT DWORD  dwVersion;
    IN DWORD  dwReserved;

    OUT DWORD  cbSigPublicKey;
    OUT PBYTE  pbSigPublicKey;

    OUT DWORD  cbKeyExPublicKey;
    OUT PBYTE  pbKeyExPublicKey;

If the cbSigPublicKey and pbSigPublicKey members are not set in the CONTAINER_INFO structure, it implies that the Signature key is not present.

If the cbKeyExPublicKey and pbKeyExPublicKey members are not set in the CONTAINER_INFO structure, it implies that the Encryption (Key Exchange) key is not present.

The dwVersion member must be set by the caller.

If CardGetContainerInfo is called with an invalid or nonexistent bContainerIndex parameter, it should return the SCARD_E_NO_KEY_CONTAINER error.

It is not necessary for the caller to be authenticated to the card for CardGetContainerInfo to succeed.


Target platform



Cardmod.h (include Cardmod.h)



Send comments about this topic to Microsoft