SetCredentialsAttributesW function (sspi.h)

Sets the attributes of a credential, such as the name associated with the credential. The information is valid for any security context created with the specified credential.

Syntax

KSECDDDECLSPEC SECURITY_STATUS SEC_ENTRY SetCredentialsAttributesW(
  [in] PCredHandle   phCredential,
  [in] unsigned long ulAttribute,
  [in] void          *pBuffer,
       unsigned long cbBuffer
);

Parameters

[in] phCredential

A handle of the credentials to be set.

[in] ulAttribute

Specifies the attribute to set. This parameter can be any of the following attributes.

Value Meaning
SECPKG_CRED_ATTR_NAMES
Sets the name of a credential in a pBuffer parameter of type SecPkgCredentials_Names.

This attribute is not supported by Schannel in WOW64 mode.

SECPKG_CRED_ATTR_KDC_PROXY_SETTINGS
Sets the Kerberos proxy setting in a pBuffer parameter of type SecPkgCredentials_KdcProxySettings.

This attribute is only supported by Kerberos.

SECPKG_ATTR_SUPPORTED_ALGS
Sets the supported algorithms in a pBuffer parameter of type SecPkgCred_SupportedAlgs. All supported algorithms are included, regardless of whether they are supported by the provided certificate or enabled on the local computer.

This attribute is supported only by Schannel.

SECPKG_ATTR_CIPHER_STRENGTHS
Sets the cipher strengths in a pBuffer parameter of type SecPkgCred_CipherStrengths.

This attribute is supported only by Schannel.

SECPKG_ATTR_SUPPORTED_PROTOCOLS
Sets the supported algorithms in a pBuffer parameter of type SecPkgCred_SupportedProtocols. All supported protocols are included, regardless of whether they are supported by the provided certificate or enabled on the local computer.

This attribute is supported only by Schannel.

[in] pBuffer

A pointer to a buffer that contains the new attribute value. The type of structure returned depends on the value of ulAttribute.

cbBuffer

The size, in bytes, of the pBuffer buffer.

Return value

If the function succeeds, the return value is SEC_E_OK.

If the function fails, the return value may be one of the following error codes.

Return code Description
SEC_E_INVALID_HANDLE
The handle passed to the function is not valid.
SEC_E_UNSUPPORTED_FUNCTION
The specified attribute is not supported by Schannel. This return value will only be returned when the Schannel SSP is being used.
SEC_E_INSUFFICIENT_MEMORY
Not enough memory is available to complete the request.

Remarks

Note

The sspi.h header defines SetCredentialsAttributes 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

See also

AcquireCredentialsHandle

FreeContextBuffer

SCH_CREDENTIALS

SSPI Functions

SecPkgCred_CipherStrengths

SecPkgCred_SupportedAlgs

SecPkgCred_SupportedProtocols

SecPkgCredentials_Names