Win32 API 日本語リファレンス
ホーム › Devices.BiometricFramework › PIBIO_ENGINE_VERIFY_FEATURE_SET_FN

PIBIO_ENGINE_VERIFY_FEATURE_SET_FN

コールバック

シグネチャ

HRESULT PIBIO_ENGINE_VERIFY_FEATURE_SET_FN(
    WINBIO_PIPELINE* Pipeline,
    WINBIO_IDENTITY* Identity,
    BYTE SubFactor,
    BOOLEAN* Match,
    BYTE** PayloadBlob,
    UINT_PTR* PayloadBlobSize,
    BYTE** HashValue,
    UINT_PTR* HashSize,
    DWORD* RejectDetail
);

パラメーター

フィールド型説明
PipelineWINBIO_PIPELINE*操作を実行するバイオメトリックユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインター。
IdentityWINBIO_IDENTITY*データベースから取得されるテンプレートのものと一致することが期待される GUID または SID を格納した WINBIO_IDENTITY 構造体へのポインター。
SubFactorBYTEデータベースから取得されるテンプレートのものと一致することが期待される WINBIO_BIOMETRIC_SUBTYPE 値。 詳細については「解説」セクションを参照してください。
MatchBOOLEAN*Identity パラメーターおよび SubFactor パラメーターが、データベースから取得されたテンプレートのものと一致するかどうかを示すブール値へのポインター。TRUE は、これらの値が一致することを示します。
PayloadBlobBYTE**テンプレートとともに保存されたペイロードデータへのポインターを受け取る変数のアドレス。ペイロードデータが存在しない場合は、この値を NULL に設定します。
PayloadBlobSizeUINT_PTR*PayloadBlob パラメーターで指定されたバッファーのサイズ (バイト単位) を受け取る値へのポインター。テンプレートとともに保存されたペイロードデータが存在しない場合は、この値をゼロに設定します。
HashValueBYTE**テンプレートのハッシュへのポインターを受け取る変数のアドレス。エンジンアダプターがハッシュ生成をサポートしていない場合は、この値を NULL に設定します。
HashSizeUINT_PTR*HashValue パラメーターで指定されたハッシュのサイズ (バイト単位) を格納する値へのポインター。エンジンアダプターがハッシュ生成をサポートしていない場合は、この値をゼロに設定します。
RejectDetailDWORD*

キャプチャの失敗によってエンジンが照合操作を実行できない場合に、追加情報を受け取る WINBIO_REJECT_DETAIL 値へのポインター。直近のキャプチャが成功した場合は、このパラメーターをゼロに設定します。指紋キャプチャについては、次の値が定義されています。

  • WINBIO_FP_TOO_HIGH
  • WINBIO_FP_TOO_LOW
  • WINBIO_FP_TOO_LEFT
  • WINBIO_FP_TOO_RIGHT
  • WINBIO_FP_TOO_FAST
  • WINBIO_FP_TOO_SLOW
  • WINBIO_FP_POOR_QUALITY
  • WINBIO_FP_TOO_SKEWED
  • WINBIO_FP_TOO_SHORT
  • WINBIO_FP_MERGE_FAILURE

公式ドキュメント

現在の特徴セット内のテンプレートをデータベース内の特定のテンプレートと比較するために、Windows Biometric Framework から呼び出されます。テンプレートが等価である場合、エンジンアダプターは Match パラメーターが指すブール値を TRUE に設定し、一致したテンプレートを PayloadBlob パラメーターで返し、テンプレートのハッシュを HashValue パラメーターで返す必要があります。

戻り値

関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次の HRESULT 値のいずれかを返す必要があります。

戻り値 説明
E_POINTER
必須のポインターパラメーターが NULL です。
E_INVALIDARG
SubFactor パラメーターに指定された値が正しくありません。
WINBIO_E_BAD_CAPTURE
特徴セットが、検証操作に対するエンジンアダプターの内部要件を満たしていません。失敗に関する詳細情報は RejectDetail パラメーターで示されます。
WINBIO_E_NO_MATCH
パイプライン内の特徴セットはデータベースに格納されているいずれかのものと一致しますが、Identity パラメーターと SubFactor パラメーターで渡された値の組み合わせには対応していません。

解説(Remarks)

SubFactor パラメーターは、バイオメトリックテンプレートに関連付けられたサブファクターを指定します。Windows Biometric Framework は指紋キャプチャのみをサポートしており、サブタイプ情報を表すために次の定数を使用できます。

重要

SubFactor パラメーターに指定された値を検証しようとしないでください。Windows Biometrics Service が、実装に値を渡す前に検証を行います。値が WINBIO_SUBTYPE_NO_INFORMATION または WINBIO_SUBTYPE_ANY の場合は、必要に応じて検証してください。

テンプレートのハッシュ生成に使用されるアルゴリズムは、このパイプラインに対して直近に呼び出された EngineAdapterSetHashAlgorithm 関数で選択されたものです。

この関数が返すハッシュ値は (返される場合)、パイプラインに関連付けられた照合側のテンプレートではなく、データベース内で見つかった登録テンプレートのハッシュです。

PayloadBlob バッファーおよび HashValue バッファーは、EngineAdapterIdentifyFeatureSet 関数が正常に戻った後は、エンジンアダプターが所有および管理します。エンジンアダプターは、このパイプラインについて、次に EngineAdapterClearContext が呼び出されるまで、バッファーのアドレスを有効に保つ必要があります。

例

次の擬似コードは、この関数の実装例の 1 つを示しています。この例はそのままではコンパイルできません。目的に合わせて適宜変更する必要があります。

//////////////////////////////////////////////////////////////////////////////////////////
//
// EngineAdapterVerifyFeatureSet
//
// Purpose:
//      Compares the template in the current feature set with a specific 
//      template in the database.
//      
// Parameters:
//      Pipeline        - Pointer to a WINBIO_PIPELINE structure associated 
//                        with the biometric unit performing the operation
//      Identity        - GUID or SID that is expected to match that of the 
//                        template recovered from the database
//      SubFactor       - A WINBIO_BIOMETRIC_SUBTYPE value that is expected 
//                        to match that of the template recovered from the 
//                        database
//      Match           - A Boolean value that specifies whether the Identity 
//                        and SubFactor parameters match those of the template
//                        recovered from the database
//      PayloadBlob     - Payload data saved with the template
//      PayloadBlobSize - Size, in bytes, of the buffer specified in the 
//                        PayloadBlob parameter
//      HashValue       - Hash of the template
//      HashSize        - Size, in bytes, of the hash specified by the 
//                        HashValue parameter
//      RejectDetail    - Receives additional information if a capture failure 
//                        prevents the engine from performing a matching operation
// 
static HRESULT
WINAPI
EngineAdapterVerifyFeatureSet(
    __inout PWINBIO_PIPELINE Pipeline,
    __in PWINBIO_IDENTITY Identity,
    __in WINBIO_BIOMETRIC_SUBTYPE SubFactor,
    __out PBOOLEAN Match,
    __out PUCHAR *PayloadBlob,
    __out PSIZE_T PayloadBlobSize,
    __out PUCHAR *HashValue,
    __out PSIZE_T HashSize,
    __out PWINBIO_REJECT_DETAIL RejectDetail
    )
{
    HRESULT hr = S_OK;
    WINBIO_STORAGE_RECORD thisRecord;
    BOOLEAN match = FALSE;
    WINBIO_REJECT_DETAIL rejectDetail = 0;

    // Verify that pointer arguments are not NULL.
    if (!ARGUMENT_PRESENT(Pipeline) ||
        !ARGUMENT_PRESENT(Identity) ||
        !ARGUMENT_PRESENT(Match) ||
        !ARGUMENT_PRESENT(PayloadBlob) ||
        !ARGUMENT_PRESENT(PayloadBlobSize) ||
        !ARGUMENT_PRESENT(HashValue) ||
        !ARGUMENT_PRESENT(HashSize) ||
        !ARGUMENT_PRESENT(RejectDetail))
    {
        hr = E_POINTER;
        goto cleanup;
    }

    // Retrieve the context from the pipeline.
    PWINBIO_ENGINE_CONTEXT context = 
           (PWINBIO_ENGINE_CONTEXT)Pipeline->EngineContext;

    // Initialize the return values.
    *Match              = FALSE;
    *PayloadBlob        = NULL;
    *PayloadBlobSize    = 0;
    *HashValue          = NULL;
    *HashSize           = 0;
    *RejectDetail       = 0;

    // The biometric unit cannot perform verification or identification
    // operations while it is performing an enrollment sequence.
    if (context->Enrollment.InProgress == TRUE)
    {
        hr = WINBIO_E_ENROLLMENT_IN_PROGRESS;
        goto cleanup;
    }

    // Query the storage adapter to determine whether the Identity and 
    // SubFactor combination specified on input are in the database. If
    // they are not, there can be no match. WbioStorageQueryBySubject
    // is a wrapper function defined in the Winbio_adapter.h header file.
    hr = WbioStorageQueryBySubject( Pipeline, Identity, SubFactor);
    if (FAILED(hr))
    {
        if (hr == WINBIO_E_DATABASE_NO_RESULTS)
        {
            hr = WINBIO_E_NO_MATCH;
        }
        goto cleanup;
    }

    // Position the cursor on the first record in the database. 
    // WbioStorageFirstRecord is a wrapper function defined in the 
    // Winbio_adapter.h header file.
    hr = WbioStorageFirstRecord( Pipeline );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Retrieve the current template record for the Identity and SubFactor 
    // combination specified on input. 
    hr = WbioStorageGetCurrentRecord( Pipeline, &thisRecord );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Call a custom function (_AdapterCompareTemplateToCurrentFeatureSet)
    // to compare the feature set attached to the pipeline with the template 
    // retrieved from the database.
    // If the template and feature set do not match, return WINBIO_E_NO_MATCH
    // and set the Match parameter to FALSE.
    // If your custom function cannot process the feature set, return 
    // WINBIO_E_BAD_CAPTURE and set extended error information in the 
    // RejectDetail parameter.
    hr = _AdapterCompareTemplateToCurrentFeatureSet( 
                context, 
                context->FeatureSet,
                context->FeatureSetSize,
                thisRecord.TemplateBlob, 
                thisRecord.TemplateBlobSize,
                &match,
                RejectDetail 
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // If there is a match and if your engine adapter supports template
    // hashing, call a custom function (_AdapterGenerateHashForTemplate)
    // to calculate the hash. Save the hash value in the context area of
    // the engine adapter.
    // Skip this step if your adapter does not support template hashing.
    hr = _AdapterGenerateHashForTemplate(
                context,
                thisRecord.TemplateBlob, 
                thisRecord.TemplateBlobSize,
                context->HashBuffer,
                &context->HashSize
                );
    if (FAILED(hr))
    {
        goto cleanup;
    }

    // Set the return values.
    *Match              = TRUE;
    *PayloadBlob        = thisRecord.PayloadBlob;
    *PayloadBlobSize    = thisRecord.PayloadBlobSize;
    *HashValue          = &context->HashBuffer;
    *HashSize           = context->HashSize;

cleanup:

    if (hr == WINBIO_E_DATABASE_NO_RESULTS)
    {
        hr = WINBIO_E_NO_MATCH;
    }

    return hr;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)