ICertServerExit::GetRequestAttribute method

The GetRequestAttribute method returns a named attribute value from a request.

Prior to calling this method, it is necessary to call ICertServerExit::SetContext.

Syntax


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

Parameters

strAttributeName [in]

The name of the attribute to retrieve.

pstrAttributeValue [out]

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 ICertServerExit::SetContext prior to using this method.

The following request attributes are unique to KEYGEN style requests.

Property nameTypeDescription
ChallengeStringChallenge string that accompanies the request.
ExpectedChallengeStringIf 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 a BSTR assigned by EnumerateAttributes.
// Also, ICertServerExit::SetContext has already been
// called by pCertServerExit.
hr = pCertServerExit->GetRequestAttribute(bstrAttribName,
                                          &bstrAttribValue);

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

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

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

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Certif.h (include Certsrv.h)

Library

Certidl.lib

DLL

Certcli.dll

IID

IID_ICertServerExit is defined as 4BA9EB90-732C-11D0-8816-00A0C903B83C

See also

ICertServerExit
ICertServerExit::SetContext

 

 

Show: