ホーム › Devices.BiometricFramework › PIBIO_ENGINE_SET_HASH_ALGORITHM_FN
PIBIO_ENGINE_SET_HASH_ALGORITHM_FN
コールバックシグネチャ
HRESULT PIBIO_ENGINE_SET_HASH_ALGORITHM_FN(
WINBIO_PIPELINE* Pipeline,
UINT_PTR AlgorithmBufferSize,
BYTE* AlgorithmBuffer
);パラメーター
| フィールド | 型 | 説明 |
|---|---|---|
| Pipeline | WINBIO_PIPELINE* | 操作を実行するバイオメトリックユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインターです。 |
| AlgorithmBufferSize | UINT_PTR | AlgorithmBuffer パラメーターで指定されたバッファーのサイズ (バイト単位)。 |
| AlgorithmBuffer | BYTE* | 選択するハッシュアルゴリズムのオブジェクト識別子を格納した NULL 終端の ANSI 文字列へのポインターです。サポートされているアルゴリズムのオブジェクト識別子 (OID) の配列を取得するには、EngineAdapterQueryHashAlgorithms 関数を呼び出します。 |
公式ドキュメント
後続の操作で使用するハッシュアルゴリズムを選択するために、Windows Biometric Framework によって呼び出されます。
戻り値
関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次の HRESULT 値のいずれかを返す必要があります。
| 戻り値 | 説明 |
|---|---|
| 必須のポインターパラメーターが NULL です。 | |
| エンジンアダプターがテンプレートのハッシュ化をサポートしていません。 | |
| エンジンアダプターが、AlgorithmBuffer パラメーターで指定されたハッシュアルゴリズムをサポートしていません。 |
解説(Remarks)
Windows Biometric Framework は、バイオメトリックユニットがセンサープールに追加されるたびに、そのユニットを構成するためにこの関数を呼び出します。
ハッシュアルゴリズムはパイプラインごとに選択されるため、エンジンアダプターは選択されたアルゴリズムをプライベートなパイプラインコンテキストに保存する必要があります。
エンジンアダプターは、最後に選択されたアルゴリズムを保持し、次の関数の呼び出しを処理する際にそのアルゴリズムを使用する必要があります。
この関数で選択されたアルゴリズムは、次に EngineAdapterSetHashAlgorithm が呼び出されるまで、または EngineAdapterDetach メソッドが呼び出されるまで、選択された状態を維持する必要があります。特に、EngineAdapterClearContext 関数の呼び出しは、選択されているアルゴリズムに影響を与えてはなりません。Windows Biometric Framework が使用するハッシュアルゴリズムは SHA1 のみです。このアルゴリズムの OID 文字列値は "1.3.14.3.2.26" です。詳細については、EngineAdapterQueryHashAlgorithms を参照してください。
例
次の擬似コードは、この関数の実装例の 1 つを示しています。この例はコンパイルできません。目的に合わせて調整する必要があります。
//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterSetHashAlgorithm
//
// Purpose:
// Selects a hash algorithm for use in subsequent operations.
//
// Parameters:
// Pipeline - Pointer to a WINBIO_PIPELINE structure associated
// with the biometric unit performing the operation.
// AlgorithmBufferSize - Size, in bytes, of the buffer specified by the
// AlgorithmBuffer parameter.
// AlgorithmBuffer - Pointer to a NULL-terminated ANSI string that
// contains the object identifier of the hash algorithm
// to select.
//
static HRESULT
WINAPI
EngineAdapterSetHashAlgorithm(
__inout PWINBIO_PIPELINE Pipeline,
__in SIZE_T AlgorithmBufferSize,
__in PUCHAR AlgorithmBuffer
)
{
////////////////////////////////////////////////////////////////////////////
// Return E_NOTIMPL here if your adapter does not support template hashing.
////////////////////////////////////////////////////////////////////////////
HRESULT hr = S_OK;
SIZE_T algorithmSize = (strlen(szOID_OIWSEC_sha1) + 1) * sizeof(CHAR);
// Verify that pointer arguments are not NULL.
if (!ARGUMENT_PRESENT(Pipeline) ||
!ARGUMENT_PRESENT(AlgorithmBuffer))
{
hr = E_POINTER;
goto cleanup;
}
// Only the SHA1 hashing algorithm is supported.
// Therefore, make certain that SHA1 is included in the algorithm
// table.
// The SHA1 object identifier, szOID_OIWSEC_sha1, is contained in the
// Wincrypt.h header file.
if (AlgorithmBufferSize != algorithmSize ||
memcmp(AlgorithmBuffer, szOID_OIWSEC_sha1, algorithmSize) != 0)
{
hr = E_INVALIDARG;
goto cleanup;
}
// Make any necessary changes to the adapter state to specify that
// SHA1 hashing is enabled. If your adapter does not support template
// hashing, return E_NOTIMPL.
cleanup:
return hr;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)