QueryCredentialsAttributesA function (sspi.h)
Retrieves 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
SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
[in] PCredHandle phCredential,
[in] unsigned long ulAttribute,
[out] void *pBuffer
);
Parameters
[in] phCredential
A handle of the credentials to be queried.
[in] ulAttribute
Specifies the attribute to query. This parameter can be any of the following attributes.
Value | Meaning |
---|---|
|
Returns the certificate thumbprint in a pbuffer of type SecPkgCredentials_Cert.
This attribute is only supported by Kerberos. Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This attribute is not available. |
|
Returns the name of a credential in a pbuffer of type SecPkgCredentials_Names.
This attribute is not supported by Schannel in WOW64 mode. |
|
Returns the supported algorithms in a pbuffer 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. |
|
Returns the cipher strengths in a pbuffer of type SecPkgCred_CipherStrengths.
This attribute is supported only by Schannel. |
|
Returns the supported algorithms in a pbuffer 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. |
[out] pBuffer
A pointer to a buffer that receives the requested attribute. The type of structure returned depends on the value of ulAttribute.
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 |
---|---|
|
The handle passed to the function is not valid. |
|
The specified attribute is not supported by Schannel. This return value will only be returned when the Schannel SSP is being used. |
|
The memory that is available is not sufficient to complete the request. |
Remarks
The QueryCredentialsAttributes function allows an application to determine several characteristics of a credential, including the name associated with the specified credentials.
Querying the SECPKG_ATTR_CIPHER_STRENGTHS attribute returns a SecPkgCred_CipherStrengths structure. The cipher strength in this structure is the same as the cipher strength in the SCH_CREDENTIALS structure used when a credential was created.
Querying the SECPKG_ATTR_SUPPORTED_PROTOCOLS attribute returns a SecPkgCred_SupportedProtocols structure that contains a bit array compatible with the grbitEnabledProtocols field of the SCH_CREDENTIALS structure.
The caller must allocate the structure pointed to by the pBuffer parameter. The security package allocates the buffer for any pointer returned in the pBuffer structure. The caller can call the FreeContextBuffer function to free any pointers allocated by the security package.
Note
The sspi.h header defines QueryCredentialsAttributes 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 |