SetContextAttributesW function (sspi.h)

Enables a transport application to set attributes of a security context for a security package. This function is supported only by the Schannel security package.

Syntax

SECURITY_STATUS SEC_ENTRY SetContextAttributesW(
  [in] PCtxtHandle   phContext,
  [in] unsigned long ulAttribute,
  [in] void          *pBuffer,
  [in] unsigned long cbBuffer
);

Parameters

[in] phContext

A handle to the security context to be set.

[in] ulAttribute

The attribute of the context to be set. This parameter can be one of the following values.

Value Meaning
SECPKG_ATTR_APP_DATA
94
The pBuffer parameter contains a pointer to a SecPkgContext_SessionAppData structure.

Sets application data for the session.

This attribute is supported only by the Schannel security package.

SECPKG_ATTR_EAP_PRF_INFO
101
The pBuffer parameter contains a pointer to a SecPkgContext_EapPrfInfo structure.

Sets the pseudo-random function (PRF) used by the Extensible Authentication Protocol (EAP). This is the value that is returned by a call to the QueryContextAttributes (Schannel) function when SECPKG_ATTR_EAP_KEY_BLOCK is passed as the value of the ulAttribute parameter.

This attribute is supported only by the Schannel security package.

SECPKG_ATTR_EARLY_START
105
The pBuffer parameter contains a pointer to a SecPkgContext_EarlyStart structure.

Sets the False Start feature. See the Building a faster and more secure web blog post for information on this feature.

SECPKG_ATTR_DTLS_MTU
34
Sets and retrieves the MTU (maximum transmission unit) value for use with DTLS. If DTLS is not enabled in a security context, this attribute is not supported.

Valid values are between 200 bytes and 64 kilobytes. The default DTLS MTU value in Schannel is 1096 bytes.

SECPKG_ATTR_KEYING_MATERIAL_INFO
106
The pBuffer parameter contains a pointer to a SecPkgContext_KeyingMaterialInfo structure. The keying material export feature follows the RFC 5705 standard.

This attribute is supported only by the Schannel security package in Windows 10 and Windows Server 2016 or later versions.

[in] pBuffer

A pointer to a structure that contains values to set the attributes to. The type of structure pointed to depends on the value specified in the ulAttribute parameter.

[in] cbBuffer

The size, in bytes, of the pBuffer parameter.

Return value

If the function succeeds, the function returns SEC_E_OK.

If the function fails, it returns a nonzero error code. The following error code is one of the possible error codes.

Return code Description
SEC_E_UNSUPPORTED_FUNCTION
This value is returned by Schannel kernel mode to indicate that this function is not supported.

Remarks

Note

The sspi.h header defines SetContextAttributes as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header sspi.h (include Security.h)
Library Secur32.lib
DLL Secur32.dll