共用方式為


QueryContextAttributes

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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

Syntax

SECURITY_STATUS SEC_ENTRY QueryContextAttributes( 
  PCtxtHandle phContext,
  ULONG ulAttribute, 
  void SEC_FAR* pBuffer 
);

Parameters

  • phContext
    [in] Pointer to a CtxtHandle structure identifying the context handle. For information about CtxtHandle, see SSPI Handles.
  • ulAttribute
    [in] Pointer to a buffer containing attributes of the context to be retrieved. The following table shows the possible values.

    Value Description

    SECPKG_ATTR_AUTHORITY

    Queries the name of the authenticating authority. The pBuffer parameter is a pointer to a SecPkgContext_Authority structure.

    SECPKG_ATTR_CONNECTION_INFO

    Retrieves protocol and cipher information in a SecPkgContext_ConnectionInfo structure.

    SECPKG_ATTR_ISSUER_LIST

    Obsolete. Use SECPKG_ATTR_ISSUER_LIST_EX.

    SECPKG_ATTR_ISSUER_LIST_EX

    Retrieves a list of trusted CA names in a SecPkgContext_IssuerListInfoEx structure.

    SECPKG_ATTR_DCE_INFO

    Queries for authorization data used by distributed computing environment (DCE) services. PBuffer is a pointer to a SecPkgContext_DceInfo structure.

    SECPKG_ATTR_KEY_INFO

    Queries information about the keys used in a security context. The pBuffer parameter is a pointer to a SecPkgContext_KeyInfo structure.

    SECPKG_ATTR_LIFESPAN

    Queries the life span of the context. pBuffer is a pointer to a SecPkgContext_Lifespan structure.

    SECPKG_ATTR_LOCAL_CERT_CONTEXT

    Retrieves the certificate used to establish the local side of the connection. Uses a CERT_CONTEXT structure.

    SECPKG_ATTR_LOCAL_CRED

    Obsolete. Use SECPKG_ATTR_LOCAL_CERT_CONTEXT.

    SECPKG_ATTR_MASTER_KEY_INFO

    Retrieves the raw master key and client/server random numbers. Uses a SecPkgContext_MasterKeyInfo structure. Valid only if the TLS protocol is negotiated. Available only to trusted callers.

    SECPKG_ATTR_NAMES

    Queries the name associated with the context. The pBuffer parameter is a pointer to a SecPkgContext_Names structure.

    SECPKG_ATTR_PROTO_INFO

    This value has been superseded by SECPKG_ATTR_CONNECTION_INFO. Retrieves information about the selected protocol. Uses a SecPkgContext_ProtoInfo structure.

    SECPKG_ATTR_REMOTE_CERT_CONTEXT

    Retrieves the certificate used to establish the remote side of the connection. Uses a CERT_CONTEXT structure.

    SECPKG_ATTR_REMOTE_CRED

    Obsolete. Use SECPKG_ATTR_REMOTE_CERT_CONTEXT.

    SECPKG_ATTR_SIZES

    Queries the sizes of the structures used in the per-message functions. The pBuffer parameter is a pointer to a SecPkgContext_Sizes structure.

    SECPKG_ATTR_STREAM_SIZES

    Queries the sizes of the various stream objects used in the per-message functions. The pBuffer parameter is a pointer to a SecPkgContext_StreamSizes structure.

  • 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 Value

Returns SEC_E_OK to indicate success. The function returns a nonzero error value to indicate failure.

Remarks

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

Requirements

Header security.h, sspi.h
Library secur32.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Smartphone 2002 and later

See Also

Reference

FreeContextBuffer
SecPkgContext_Authority
SecPkgContext_DceInfo
SecPkgContext_KeyInfo
SecPkgContext_Lifespan
SecPkgContext_MasterKeyInfo
SecPkgContext_Names
SecPkgContext_Sizes
SecPkgContext_StreamSizes