MDImportSessionKey function

The MDImportSessionKey function imports a temporary session key to the card minidriver and returns a key handle to the caller.

Syntax


DWORD WINAPI MDImportSessionKey(
  _In_  PCARD_DATA       pCardData,
  _In_  LPCWSTR          pwszBlobType,
  _In_  LPCWSTR          pwszAlgId,
  _Out_ PCARD_KEY_HANDLE phKey,
  _In_  PBYTE            pbInput,
  _In_  DWORD            cbInput
);

Parameters

pCardData [in]

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

pwszBlobType [in]

A pointer to a null-terminated Unicode string. This string identifies the type of BLOB that is contained in the pbInput buffer.

pwszAlgId [in]

A pointer to a null-terminated Unicode string. This string identifies the algorithm to be used to encrypt the key. For more information, see the description of CP_ENUM_ALGORITHMS in CardGetProperty.

phKey [out]

A pointer to a CARD_KEY_HANDLE that receives the handle of the imported key. This handle is used in subsequent function calls that require the key, such as CardProcessEncryptedData. The caller must release the handle when it is no longer needed by calling CardDestroyKey.

pbInput [in]

The address of a buffer that contains the key BLOB to be imported. The cbInput contains the size of this buffer. The pwszBlobType parameter specifies the type of key BLOB that this buffer contains.

cbInput [in]

The size, in bytes, of the key BLOB in the pbInput buffer.

Return value

Zero on success; otherwise, nonzero.

Remarks

If the card minidriver does not support the import of temporary symmetric keys, it should return SCARD_E_UNSUPPORTED_FEATURE.

The pwszBlobType parameter can currently have only the following value.

“KeyDataBlob”

The pbInput parameter is a pointer to a buffer that contains a BCRYPT_KEY_DATA_BLOB_HEADER structure. The key BLOB data immediately follows the BCRYPT_KEY_DATA_BLOB_HEADER structure in the buffer.

If pwszBlobType contains an invalid or undefined value, the function should return SCARD_E_INVALID_PARAMETER. For legacy applications and cards that use the minidriver interface for secure key injection, the minidriver can accept proprietary BLOB types.

If pwszAlgId contains an invalid or undefined value, the function should return SCARD_E_INVALID_PARAMETER. If the pwszAlgId value is defined but not supported, the function should return SCARD_E_UNSUPPORTED_FEATURE. For legacy cards, the minidriver can support other algorithms.

When the function returns, the phKey parameter should contain a handle to the imported key. If the parameter does not contain a valid pointer, the function should return SCARD_E_INVALID_PARAMETER. The key is expected to be valid until either CardDestroyKey is called or the card is removed from the reader.

Requirements

Target platform

Desktop

Header

Cardmod.h (include Cardmod.h)

 

 

Send comments about this topic to Microsoft

Show: