QueryCredentialsAttributes function
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 QueryCredentialsAttributes( _In_ PCredHandle phCredential, _In_ ULONG ulAttribute, _Out_ PVOID pBuffer );
Parameters
- phCredential [in]
-
A handle of the credentials to be queried.
- ulAttribute [in]
-
Specifies the attribute to query. This parameter can be any of the following attributes.
Value Meaning - SECPKG_CRED_ATTR_CERT
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.
- SECPKG_CRED_ATTR_NAMES
Returns the name of a credential in a pbuffer of type SecPkgCredentials_Names.
This attribute is not supported by Schannel in WOW64 mode.
- SECPKG_ATTR_SUPPORTED_ALGS
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.
- SECPKG_ATTR_CIPHER_STRENGTHS
Returns the cipher strengths in a pbuffer of type SecPkgCred_CipherStrengths.
This attribute is supported only by Schannel.
- SECPKG_ATTR_SUPPORTED_PROTOCOLS
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.
- pBuffer [out]
-
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 SCHANNEL_CRED structure used when a credential was created.
Querying the SECPKG_ATTR_SUPPORTED_ALGS attribute returns a SecPkgCred_SupportedAlgs structure. The algorithms in this structure are compatible with those indicated in the SCHANNEL_CRED 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 SCHANNEL_CRED 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.
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
QueryCredentialsAttributesW (Unicode) and QueryCredentialsAttributesA (ANSI) |
See also
- SSPI Functions
- AcquireCredentialsHandle
- FreeContextBuffer
- SCHANNEL_CRED
- SecPkgCred_CipherStrengths
- SecPkgCred_SupportedAlgs
- SecPkgCred_SupportedProtocols
- SecPkgCredentials_Names