ホーム › Devices.BiometricFramework › PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN
PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN
コールバックシグネチャ
HRESULT PIBIO_ENGINE_GET_ENROLLMENT_HASH_FN(
WINBIO_PIPELINE* Pipeline,
BYTE** HashValue,
UINT_PTR* HashSize
);パラメーター
| フィールド | 型 | 説明 |
|---|---|---|
| Pipeline | WINBIO_PIPELINE* | 操作を実行するバイオメトリック ユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインターです。 |
| HashValue | BYTE** | テンプレートのハッシュを格納するバイト配列へのポインターを受け取る変数のアドレスです。 |
| HashSize | UINT_PTR* | HashValue パラメーターが指すハッシュのサイズ (バイト単位) を受け取る変数へのポインターです。 |
公式ドキュメント
パイプライン内の完了した登録テンプレートのハッシュを取得するために、Windows Biometric Framework から呼び出されます。
戻り値
関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次の HRESULT 値のいずれかを返す必要があります。
| 戻り値 | 説明 |
|---|---|
| 必須のポインター パラメーターが NULL です。 | |
| エンジン アダプターはテンプレート ハッシュの生成をサポートしていません。 | |
| パイプラインに、完了した登録テンプレートが含まれていません。 |
解説(Remarks)
この関数でハッシュを計算するテンプレートは、EngineAdapterCommitEnrollment が呼び出されたときにデータベースへ保存される、完了した登録テンプレートでなければなりません。キャプチャされた中間サンプルをハッシュしてはいけません。
テンプレート ハッシュの生成に使用されるアルゴリズムは、このパイプラインに対して直近に呼び出された EngineAdapterSetHashAlgorithm で選択されたものです。
ハッシュを格納するメモリは、EngineAdapterGetEnrollmentHash 関数が正常に復帰した後、エンジン アダプターが所有および管理します。エンジン アダプターは、Framework が次のいずれかの関数を呼び出すまで、バッファーのアドレスを有効なまま保持する必要があります。
エンジン アダプターは、パイプラインごとに個別のハッシュ バッファーも保持する必要があります。例
次の擬似コードは、この関数の実装例の 1 つを示しています。この例はそのままではコンパイルできません。目的に合わせて適宜変更してください。
//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterGetEnrollmentHash
//
// Purpose:
// Retrieves the hash of the completed enrollment template in the pipeline.
//
// Parameters:
// Pipeline - Pointer to a WINBIO_PIPELINE structure associated
// with the biometric unit performing the operation
// HashValue - Contains the hash of the template
// HashSize - Size, in bytes, of the hash pointed to by the
// HashValue parameter
//
static HRESULT
WINAPI
EngineAdapterGetEnrollmentHash(
__inout PWINBIO_PIPELINE Pipeline,
__out PUCHAR *HashValue,
__out PSIZE_T HashSize
)
{
////////////////////////////////////////////////////////////////////////////
// Return E_NOTIMPL here if your adapter does not support template hashing.
////////////////////////////////////////////////////////////////////////////
HRESULT hr = S_OK;
// Verify that pointer arguments are not NULL.
if (!ARGUMENT_PRESENT(Pipeline) ||
!ARGUMENT_PRESENT(HashValue) ||
!ARGUMENT_PRESENT(HashSize))
{
hr = E_POINTER;
goto cleanup;
}
// Retrieve the context from the pipeline.
PWINBIO_ENGINE_CONTEXT context =
(PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;
// Return if an enrollment is not in progress. This example assumes that
// an enrollment object is part of your engine context structure.
if (context->Enrollment.InProgress != TRUE)
{
hr = WINBIO_E_INVALID_DEVICE_STATE;
goto cleanup;
}
// Initialize the hash.
*HashValue = NULL;
*HashSize = 0;
// If your engine adapter supports template hashing, call a custom function
// (_AdapterGenerateHashForTemplate) to calculate the hash of the new
// enrollment template. The hash value should be saved in the adapter
// context.
hr = _AdapterGenerateHashForTemplate(
context,
context->Enrollment.Template,
context->Enrollment.TemplateSize,
context->HashBuffer,
&context->HashSize
);
if (FAILED(hr))
{
goto cleanup;
}
// Return the hash to the caller.
*HashValue = context->HashBuffer;
*HashSize = context->HashSize;
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)