KodeZwerg 54 Posted March 4, 2021 (edited) Good day, I would like to have ability in my project to show certificate details of signed executables. (From other executables) Is that possible with Delphi? Would love to get hints 'how-to'! //edit For now I have ability to get raw data thats appended to executables (overlay data) by simply check PE header for filesize and compare with real physical filesize. Edited March 4, 2021 by KodeZwerg Share this post Link to post
FPiette 385 Posted March 4, 2021 Probably what you are looking for is explained in Microsoft documentation. 1 1 Share this post Link to post
KodeZwerg 54 Posted March 4, 2021 Will try to follow those steps, thank you for link! Share this post Link to post
Angus Robertson 577 Posted March 4, 2021 I have a component that checks signing certificates: https://www.magsys.co.uk/delphi/magtrustchk.asp Angus 2 Share this post Link to post
davornik 4 Posted April 29 (edited) Maybe you can check if file is signed with this: uses Winapi.ImageHlp; function IsFileDigitallySigned(const FileName: string): Boolean; var FileHandle: THandle; CertHeader: TWinCertificate; begin Result := False; FileHandle := CreateFile(PChar(FileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0); if FileHandle <> INVALID_HANDLE_VALUE then try FillChar(CertHeader, SizeOf(CertHeader), 0); Result := ImageGetCertificateHeader(FileHandle, 0, CertHeader); finally CloseHandle(FileHandle); end; end; Edited April 29 by davornik Share this post Link to post
Angus Robertson 577 Posted April 29 Beware TWinCertificate is only declared in Delphi 12, perhaps ImageHlp as well. But I'll look at those functions to allow verifying the signing chain using OpenSSL instead of the slow capicom.dll COM object used by my component at the moment, but not looked at the component for several years. Angus Share this post Link to post