CiCheckSignedFile - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntfill.h

// rev
typedef // routine: CiCheckSignedFile (before 6.1.7601.18519)
_Function_class_(CI_CHECK_SIGNED_FILE_LEGACY)
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
NTSTATUS
NTAPI
CI_CHECK_SIGNED_FILE_LEGACY(
    _In_bytecount_(MINCRYPT_SHA1_HASH_LEN) PBYTE Hash,
    _In_bytecount_(SignatureSize) PBYTE Signature,
    _In_ ULONG SignatureSize,
    _Inout_opt_ PMINCRYPT_POLICY_INFO PolicyInfo,
    _Out_opt_ PLARGE_INTEGER SigningTime,
    _Inout_opt_ PMINCRYPT_POLICY_INFO TimeStampPolicyInfo
    );

View code on GitHub
// ntfill.h

// rev
typedef // routine: CiCheckSignedFile (6.1.7601.18519 and later)
_Function_class_(CI_CHECK_SIGNED_FILE)
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
NTSTATUS
NTAPI
CI_CHECK_SIGNED_FILE(
    _In_bytecount_(HashSize) PBYTE Hash,
    _In_ ULONG HashSize,
    _In_ ALG_ID AlgorithmId,
    _In_bytecount_(SignatureSize) PBYTE Signature,
    _In_ ULONG SignatureSize,
    _Inout_opt_ PMINCRYPT_POLICY_INFO PolicyInfo,
    _Out_opt_ PLARGE_INTEGER SigningTime,
    _Inout_opt_ PMINCRYPT_POLICY_INFO TimeStampPolicyInfo
    );

View code on GitHub

NtDoc

For an input Authenticode file digest and an Authenticode signature, verifies that the digest is in the signature and that the signature validates. Optionally returns information about the signature. The caller is responsible for mapping the image, parsing its PE headers, locating the WIN_CERTIFICATE in the security directory, and computing the Authenticode digest.

Parameters

Remarks

This function is exported from ci.dll. It is suitable for drivers that have already mapped and hashed the target image themselves. CiValidateFileObject provides a higher-level alternative that performs the mapping and hashing for the caller but applies a stricter policy.

Prior to build 6.1.7601.18519, the function had a legacy prototype that only accepted SHA-1 hashes and did not take explicit size and algorithm parameters.

For more details, see Code Integrity in the Kernel: A Look Into ci.dll by Liron Zuarets and Ido Moshe.

See also