{"id":21012315,"url":"https://github.com/vcsjones/authenticodeexaminer","last_synced_at":"2025-04-10T04:57:43.413Z","repository":{"id":60774173,"uuid":"153009508","full_name":"vcsjones/AuthenticodeExaminer","owner":"vcsjones","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-14T18:47:07.000Z","size":90,"stargazers_count":51,"open_issues_count":3,"forks_count":16,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-03T03:41:24.468Z","etag":null,"topics":["authenticode"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vcsjones.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-14T19:14:12.000Z","updated_at":"2025-03-15T02:47:08.000Z","dependencies_parsed_at":"2023-01-25T20:30:52.106Z","dependency_job_id":null,"html_url":"https://github.com/vcsjones/AuthenticodeExaminer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcsjones%2FAuthenticodeExaminer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcsjones%2FAuthenticodeExaminer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcsjones%2FAuthenticodeExaminer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcsjones%2FAuthenticodeExaminer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vcsjones","download_url":"https://codeload.github.com/vcsjones/AuthenticodeExaminer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161264,"owners_count":21057554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authenticode"],"created_at":"2024-11-19T09:36:16.152Z","updated_at":"2025-04-10T04:57:43.391Z","avatar_url":"https://github.com/vcsjones.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Authenticode Examiner\n=====================\n\nAuthenticode Examiner is a Windows-only library for inspecting, verifying, and examining\nany Authenticode signed file such a DLL, EXE, MSI, CAB, etc.\n\nThe library is a wrapper around native Windows APIs that provide this functionality. This\nis an intentional design decision to avoid having to implement security-critical code, and\nto ensure forward compatibility as Windows gains new functionality for new file types.\n\nAuthenticode Examiner has three components for its use.\n\n## Verifying Signatures\n\nValidating the integrity of an Authenticode signed file is simple enough using:\n\n```csharp\nvar inspector = new FileInspector(path_to_file);\nvar validationResult = inspector.Validate();\n```\n\nThe result of `Validate` will be `Valid` if the signature. All other values of the\nenumeration indicate some kind of failure. The enumeration is also not exhaustive,\nthat is it may contain unnamed values indicating failure. Therefore, testing for\n`Valid` specificially must be done to check for validity. Checking only the failure\ncases and assuming it is valid if none of the error cases match is incorrect.\n\n### Correct\n\n```csharp\nvar inspector = new FileInspector(path);\nvar result = inspector.Validate();\nif (result == SignatureCheckResult.Valid) {\n    Console.WriteLine(\"VALID!\");\n}\nelse if (result == SignatureCheckResult.BadDigest) {\n    Console.WriteLine(\"BAD SIGNATURE!\");\n}\n//More cases if desired\nelse {\n    Console.WriteLine(\"IT'S BAD FOR SOME REASON!\");\n}\n```\n\n### Incorrect\n\n```csharp\n#error This is example code that is incorrect and should not be used.\nvar inspector = new FileInspector(path);\nvar result = inspector.Validate();\nif (result == SignatureCheckResult.BadDigest) {\n    Console.WriteLine(\"BAD SIGNATURE!\");\n}\nelse { //Incorrect!\n    Console.WriteLine(\"VALID!\");\n}\n```\n\n## Inspecting Signatures\n\nThere are two means of inspecting the signatures themselves. There is\na high level approach for getting basic signature details in a \"flattened\"\nstructure. This makes it easy to enumerate basic signature information without\ntoo much detail about how the signature is actually formed.\n\n\n```csharp\nvar inspector = new FileInspector(path);\nvar signatures = inspector.GetSignatures();\n```\n\n`signatures` is an enumerable of `AuthenticodeSignature`, which contains basic\ninformation about a signature, and related timestamp signatures, and the\ncertificate of the signature. Note that this intentionally does not expose an\nAPI for determining if an individual signature is valid or not; Authenticode\nvalidity of a file must consider things other than individual signatures. For\ndetermining validity, use the `Validate` on `FileInspector`.\n\nLower-level signature details can be determined using `SignatureTreeInspector`.\nThis type can be used to determine how signatures relate to one another and\ngetting specific signature types. For example, to get only RFC3161 timestamp\nsignatures:\n\n```csharp\nvar signatures = SignatureTreeInspector.Extract(path);\nvar rfc3161 = signatures.VisitAll(SignatureKind.Rfc3161Timestamp, true);\n```\n\nGenerally, the higher-level API in `FileInspector` is preferable.\n\nA complete example is available in the `sample` sub directory of the repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcsjones%2Fauthenticodeexaminer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvcsjones%2Fauthenticodeexaminer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcsjones%2Fauthenticodeexaminer/lists"}