ICertServerPolicy::GetRequestAttribute メソッド (certif.h)

GetRequestAttribute メソッドは、要求から名前付き属性を返します。

構文

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

パラメーター

[in] strAttributeName

取得する属性の名前。

[out] pstrAttributeValue

属性値を含む BSTR 値へのポインター。

戻り値

C++

メソッドが成功した場合、メソッドは S_OKを返し、*pstrAttributeValue は属性値を含む BSTR に設定されます。

このメソッドを使用するには、 BSTR 型の変数を作成し、変数を NULL に設定し、この変数のアドレス を pstrAttributeValue として渡します。

BSTR の使用が完了したら、SysFreeString 関数を呼び出して解放します。

メソッドが失敗した場合は、エラーを示す HRESULT 値を返します。 一般的なエラー コードの一覧については、「 共通 HRESULT 値」を参照してください。

VB

戻り値は、属性値を表す文字列です。

注釈

このメソッドを使用する前に 、ICertServerPolicy::SetContext を呼び出す必要があります。

次の要求属性は、KEYGEN スタイルの要求に固有です。

プロパティ名 Type 説明
課題 String 要求に付随するチャレンジ文字列。
ExpectedChallenge String チャレンジ文字列が正しくない場合、サーバーは、エラーを診断できるように、この要求属性の値を予想されるチャレンジに設定します。
 

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);

要件

要件
サポートされている最小のクライアント サポートなし
サポートされている最小のサーバー Windows Server 2003 (デスクトップ アプリのみ)
対象プラットフォーム Windows
ヘッダー certif.h (Certsrv.h を含む)
Library Certidl.lib
[DLL] Certcli.dll

こちらもご覧ください

ICertServerPolicy

ICertServerPolicy::SetContext