LibreOffice Module onlineupdate (master) 1
Functions | Variables
certificatecheck.cxx File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <softpub.h>
#include <wintrust.h>
#include "certificatecheck.hxx"
#include "servicebase.hxx"
Include dependency graph for certificatecheck.cxx:

Go to the source code of this file.

Functions

DWORD CheckCertificateForPEFile (LPCWSTR filePath, CertificateCheckInfo &infoToMatch)
 Checks to see if a file stored at filePath matches the specified info. More...
 
BOOL DoCertificateAttributesMatch (PCCERT_CONTEXT certContext, CertificateCheckInfo &infoToMatch)
 Checks to see if a file stored at filePath matches the specified info. More...
 
LPWSTR AllocateAndCopyWideString (LPCWSTR inputString)
 Duplicates the specified string. More...
 
DWORD VerifyCertificateTrustForFile (LPCWSTR filePath)
 Verifies the trust of the specified file path. More...
 

Variables

static const int ENCODING = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
 

Function Documentation

◆ AllocateAndCopyWideString()

LPWSTR AllocateAndCopyWideString ( LPCWSTR  inputString)

Duplicates the specified string.

Parameters
inputStringThe string to duplicate
Returns
The duplicated string which should be freed by the caller.

Definition at line 234 of file certificatecheck.cxx.

◆ CheckCertificateForPEFile()

DWORD CheckCertificateForPEFile ( LPCWSTR  filePath,
CertificateCheckInfo infoToMatch 
)

Checks to see if a file stored at filePath matches the specified info.

Parameters
filePathThe PE file path to check
infoToMatchThe acceptable information to match
Returns
ERROR_SUCCESS if successful, ERROR_NOT_FOUND if the info does not match, or the last error otherwise.

Definition at line 28 of file certificatecheck.cxx.

References cleanup(), DoCertificateAttributesMatch(), ENCODING, filePath, LOG_WARN, and result.

Referenced by DoesBinaryMatchAllowedCertificates().

◆ DoCertificateAttributesMatch()

BOOL DoCertificateAttributesMatch ( PCCERT_CONTEXT  certContext,
CertificateCheckInfo infoToMatch 
)

Checks to see if a file stored at filePath matches the specified info.

Parameters
certContextThe certificate context of the file
infoToMatchThe acceptable information to match
Returns
FALSE if the info does not match or if any error occurs in the check

Definition at line 132 of file certificatecheck.cxx.

References FALSE, CertificateCheckInfo::issuer, LOG_WARN, CertificateCheckInfo::name, and TRUE.

Referenced by CheckCertificateForPEFile().

◆ VerifyCertificateTrustForFile()

DWORD VerifyCertificateTrustForFile ( LPCWSTR  filePath)

Verifies the trust of the specified file path.

Parameters
filePathThe file path to check.
Returns
ERROR_SUCCESS if successful, or the last error code otherwise.

Definition at line 252 of file certificatecheck.cxx.

References filePath, LOG, LOG_WARN, and LONG.

Referenced by DoesBinaryMatchAllowedCertificates().

Variable Documentation

◆ ENCODING

const int ENCODING = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
static

Definition at line 17 of file certificatecheck.cxx.

Referenced by CheckCertificateForPEFile().