ICertServerPolicy::GetRequestAttribute method (certif.h)

The GetRequestAttribute method returns a named attribute from a request.

Syntax

HRESULT GetRequestAttribute(
  [in]  const BSTR strAttributeName,
  [out] BSTR       *pstrAttributeValue
);

Parameters

[in] strAttributeName

The name of the attribute to retrieve.

[out] pstrAttributeValue

A pointer to a BSTR value that will contain the attribute value.

Return value

C++

If the method succeeds, the method returns S_OK and *pstrAttributeValue is set to the BSTR that contains the attribute value.

To use this method, create a variable of type BSTR, set the variable equal to NULL, and pass the address of this variable as pstrAttributeValue.

When you have finished using the BSTR, free it by calling the SysFreeString function.

If the method fails, it returns an HRESULT value that indicates the error. For a list of common error codes, see Common HRESULT Values.

VB

The return value is a string that represents the attribute value.

Remarks

You must call ICertServerPolicy::SetContext prior to using this method.

The following request attributes are unique to KEYGEN style requests.

Property name Type Description
Challenge String Challenge string that accompanies the request.
ExpectedChallenge String If the challenge string is incorrect, then the server will set the value of this request attribute to the expected challenge so that failure can be diagnosed.
 

Examples

BSTR     bstrAttribValue = NULL;
HRESULT  hr;

// Get the request attribute.
// bstrAttribName is BSTR assigned by EnumerateAttributes.
// pCertServerPolicy has been used to call SetContext previously.
hr = pCertServerPolicy->GetRequestAttribute(bstrAttribName,
                                            &bstrAttribValue);

if (FAILED(hr))
{
    printf("Failed GetRequestAttribute [%x]\n", hr);
    goto error;
}
else
{

    // Successful call. Use the bstrAttribValue as needed.
    // ...
}

// Done processing. Free BSTR.
if (NULL != bstrAttribValue)
    SysFreeString(bstrAttribValue);

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header certif.h (include Certsrv.h)
Library Certidl.lib
DLL Certcli.dll

See also

ICertServerPolicy

ICertServerPolicy::SetContext