TokenBindingGenerateBinding function (tokenbinding.h)

Constructs one token binding that contains the exported public key and signature by using the specified key type for the token binding, a target identifier string for creating and retrieving the token binding key, and the unique data. This function also returns the token binding identifier, if needed.


SECURITY_STATUS TokenBindingGenerateBinding(
  [in]            PCWSTR                           targetURL,
  [in]            TOKENBINDING_TYPE                bindingType,
  [in]            const void                       *tlsEKM,
  [in]            DWORD                            tlsEKMSize,
  [in]            TOKENBINDING_EXTENSION_FORMAT    extensionFormat,
  [in]            const void                       *extensionData,
  [out]           void                             **tokenBinding,
  [out]           DWORD                            *tokenBindingSize,
  [out, optional] TOKENBINDING_RESULT_DATA         **resultData


[in] keyType

The negotiated key type to use. Use a value from the list of key types that you retrieved by calling the TokenBindingGetKeyTypesClient function.

[in] targetURL

The target string to use in conjunction with the key type to generate or retrieve a token binding key for the NCrypt operations that build the buffer for the tokenBinding parameter.

[in] bindingType

The type of token binding that TokenBindingGenerateBinding should generate.

[in] tlsEKM

A pointer to the buffer that contains unique data.

[in] tlsEKMSize

The size of the buffer that the tlsUnique parameter points to, in bytes.

[in] extensionFormat

The format to use to interpret the data in the extensionData parameter. This value must be TOKENBINDING_EXTENSION_FORMAT_UNDEFINED.

[in] extensionData

A pointer to a buffer that contains extension data. The value of the extensionFormat parameter determines how to interpret this data.

[out] tokenBinding

A pointer that receives the address of the token binding buffer. Use the HeapAlloc function to allocate the memory for this buffer, and the HeapFree function to free that memory.

[out] tokenBindingSize

Pointer to a variable that receives the size of the buffer allocated for the tokenBinding parameter, in bytes.

[out, optional] resultData

A pointer that receives the address of the buffer that contains result data that includes the token binding identifier of the token binding that TokenBindingGenerateBinding generates. Use the HeapAlloc function to allocate the memory for this buffer, and the HeapFree function to free that memory. Specify NULL is you do not need this information.

Return value

Returns a status code that indicates the success or failure of the function.


You can call TokenBindingGenerateBinding from user mode.


Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header tokenbinding.h
Library Tokenbinding.lib
DLL Tokenbinding.dll

See also