Platform SDK: Logon Authentication

QueryCredentialsAttributes

The QueryCredentialsAttributes function retrieves the attributes of a credential, such as the name associated with the credential.

SECURITY_STATUS QueryCredentialsAttributes(
  PCredHandle phCredential,  // credential to query
  ULONG ulAttribute,         // attribute to query
  PVOID pBuffer              // buffer that receives attributes
);

Parameters

phCredential
[in] Handle of the credentials to be queried.
ulAttribute
[in] Specifies the attribute to query. This parameter can be any of the following attributes.
Attribute pBuffer type Header required
SECPKG_CRED_ATTR_NAMES SecPkgCredentials_Names Sspi.h
SECPKG_ATTR_SUPPORTED_ALGS SecPkgCred_SupportedAlgs Schnlsp.h
SECPKG_ATTR_CIPHER_STRENGTHS SecPkgCred_CipherStrengths Schnlsp.h
SECPKG_ATTR_SUPPORTED_PROTOCOLS SecPkgCred_SupportedProtocols Schnlsp.h

pBuffer
[out] Pointer to a buffer that receives the requested attribute. See the table above.

Return Values

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.

Value Meaning
SEC_E_INVALID_HANDLE The handle passed to the function is invalid.
SEC_E_INSUFFICIENT_MEMORY Not enough memory is available 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.

Note  An application can find the system default cipher strength by querying this attribute with a default credential. A default credential is created by calling AcquireCredentialsHandlewith a NULL pAuthData parameter.

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.

The prototype for this function can be found in Sspi.h.

Requirements

  Windows NT/2000: Requires Windows NT 3.51 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Sspi.h; include Security.h.
  Library: Use Secur32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also

AcquireCredentialsHandle, FreeContextBuffer, SCHANNEL_CRED, SecPkgCred_CipherStrengths, SecPkgCred_SupportedAlgs, SecPkgCred_SupportedProtocols, SecPkgCredentials_Names