Smart Card API Functions

This topic is not current. For the most current information about the Smart Card API, see Smart Card Minidriver Specification.

Smart Card Module Functions

The following functions are implemented and used by smart card modules and the Microsoft Base Smart Card Cryptographic Service Provider.

Function Description
CardAcquireContext Initializes communication between the Microsoft Base Smart Card Cryptographic Service Provider and the smart card module.
CardAuthenticateChallenge Submits a response to a challenge issued by a smart card to authenticate a user.
CardAuthenticatePin Submits a PIN to the smart card to authenticate a user.
CardChangeAuthenticator Changes the authentication data associated with a smart card and a specified type of user.
CardConstructDHAgreement Not currently supported.
CardCreateContainer Creates a new key container on a smart card.
CardCreateDirectory Creates a subdirectory of the root directory in the file system on a smart card.
CardCreateFile Creates a file in the specified directory of a smart card.
CardDeauthenticate Reverses the effect of authenticating a user or administrator without resetting the smart card.
CardDeleteContainer Deletes a key container from a smart card.
CardDeleteContext Ends communication between the Microsoft Base Smart Card Cryptographic Service Provider and the smart card module and cleans up resources.
CardDeleteDirectory Deletes a directory from a smart card. The directory must be empty, and the caller must have permission to delete that directory.
CardDeleteFile Deletes a file from a smart card.
CardDeriveKey Creates a session key by using the information in the specified CARD_DERIVE_KEY structure.
CardDestroyDHAgreement Removes a Diffie-Hellman secret agreement from the specified key container on the smart card.
CardEnumFiles Receives an array of the names of files available in a specified directory of a smart card.
CardGetChallenge Authenticates a user with a challenge and response.
CardGetContainerInfo Gets a CONTAINER_INFO structure that contains information about a key container on a smart card.
CardGetFileInfo Gets the size and access permissions of a smart card file.
CardQueryCapabilities Gets information about the functionality provided by a smart card.
CardQueryFreeSpace Gets the amount of available memory on a smart card.
CardQueryKeySizes Gets the public key sizes supported by a smart card.
CardReadFile Reads the contents of a file into a buffer.
CardRSADecrypt Performs an RSA decryption of the specified data using the specified private key. The decryption operation must be for a single data buffer of the same size as the key modulus.
CardSignData Creates a digital signature for the specified block of data.
CardUnblockPin Unblocks a smart card that has become blocked after exceeding the maximum number of incorrect PIN entry attempts. The function also authenticates a user to the smart card.
CardWriteFile Writes data in a buffer to a file on a smart card.
CspGetDHAgreement A callback function that is set by a caller before calling the CardAcquireContext function. If the CARD_DERIVE_KEY structure used for a call to CardDeriveKey specifies a parameter of the type KDF_NCRYPT_SECRET_HANDLE, the smart card module calls this function to get the handle on the smart card.
PFN_CSP_ALLOC Points to a function that allocates a block of memory.
PFN_CSP_CACHE_ADD_FILE Points to a function that adds a file to the data cached by the Microsoft Base Smart Card Cryptographic Service Provider.
PFN_CSP_CACHE_DELETE_FILE Points to a function that deletes a file from the cache of the Microsoft Base Smart Card Cryptographic Service Provider.
PFN_CSP_CACHE_LOOKUP_FILE Points to a function that reads a file that was cached by the Microsoft Base Smart Card Cryptographic Service Provider as the result of a previous call that used the PFN_CSP_CACHE_ADD_FILE function pointer.
PFN_CSP_FREE Points to a function that frees a block of memory.
PFN_CSP_PAD_DATA Pads a data buffer for use in a cryptographic operation when the smart card itself does not perform data padding.
PFN_CSP_REALLOC Points to a function that changes the size of a previously allocated block of memory. The existing contents of the memory block are copied to the reallocated block.