Platform SDK: Logon Authentication

QueryContextAttributes

The QueryContextAttributes function enables a transport application to query a security package for certain attributes of a security context.

SECURITY_STATUS QueryContextAttributes(
  PCtxtHandle phContext,   // handle of the context to query
  ULONG ulAttribute,       // attribute to query
  PVOID pBuffer            // buffer for attributes
);

Parameters

phContext
[in] Handle to the security context to be queried.
ulAttribute
[in] Specifies the attribute of the context to be returned. This parameter can be one of the following values.
Value Meaning pBuffer type
SECPKG_ATTR_SIZES Queries the sizes of the structures used in the per-message functions. SecPkgContext_Sizes structure
SECPKG_ATTR_NAMES Queries the name associated with the context. SecPkgContext_Names structure
SECPKG_ATTR_LIFESPAN Queries the life span of the context. SecPkgContext_Lifespan structure
SECPKG_ATTR_DCE_INFO Queries for authorization data used by DCE services. SecPkgContext_DceInfo structure
SECPKG_ATTR_STREAM_SIZES Queries the sizes of the various stream components used in the per-message functions. SecPkgContext_StreamSizes structure
SECPKG_ATTR_AUTHORITY Queries the name of the authenticating authority. SecPkgContext_Authority structure
SECPKG_ATTR_KEY_INFO Queries information about the keys used in a security context. SecPkgContext_KeyInfo structure
SECPKG_ATTR_REMOTE_CERT_CONTEXT Finds a certificate context containing the end certificate supplied by the server. PCCERT_CONTEXT
SECPKG_ATTR_LOCAL_CERT_CONTEXT Finds a certificate context containing a local end certificate. PCCERT_CONTEXT
SECPKG_ATTR_ROOT_STORE Finds a certificate context containing a certificate supplied by the Root store. HCERTCONTEXT
SECPKG_ATTR_ISSUER_LIST_EX Returns a list of certificate issuers acceptable by the server. SecPkgContext_IssuerListInfoEx structure
SECPKG_ATTR_CONNECTION_INFO Returns detailed information on the established connection. SecPkgContext_ConnectionInfo structure
SECPKG_ATTR_PACKAGE_INFO Returns information on the SSP in use. SecPkgContext_PackageInfo

pBuffer
[out] Pointer to a structure that receives the attributes. The type of structure pointed to depends on the value specified in the ulAttribute parameter.

Return Values

If the function succeeds, the return value is SEC_E_OK.

If the function fails, the return value is a nonzero error code.

Remarks

The structure pointed to by the pBuffer parameter varies depending on the attribute being queried. The caller must allocate the structure itself, but the package allocates other pointers that are returned in the structure. Any pointers allocated by the package can be freed by calling the FreeContextBuffer function.

After the SECPKG_ATTR_REMOTE_CERT_CONTEXT or SECPKG_ATTR_LOCAL_CERT_CONTEXT value has been read, the hStore member will be set to a handle to a certificate store containing the intermediate certificates, if any. Also, the application is responsible for calling CertFreeCertificateContext to release the memory used by the certificate context.

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

CERT_CONTEXT, FreeContextBuffer, SecPkgContext_Authority, SecPkgContext_ConnectionInfo, SecPkgContext_DceInfo, SecPkgContext_IssuerListInfoEx, SecPkgContext_KeyInfo, SecPkgContext_Lifespan, SecPkgContext_Names, SecPkgContext_Sizes, SecPkgContext_StreamSizes