What to use to check for a specific EXE file signature?

老子叫甜甜 提交于 2019-12-11 12:32:14

问题


I found this MSDN article that explains how to retrieve information for Authenticode signed executables. It retrieves data in the following format:

Signer Certificate:

Serial Number: 00 90 1a 1a 1b 1c 1c 26 3d 4f 56 61 70 8f 94 7f e0
Issuer Name: COMODO Code Signing CA 2
Subject Name: Signer's Name

My goal here is to verify that the EXE file is signed with the specific signing certificate that belongs to the company. For that I can obviously check Subject Name, but I'm curious about the Serial Number:

  1. Can Serial Number be used to verify that the EXE file is signed with a specific certificate? My tests showed that it doesn't change if I sign more than one file.

  2. Will this serial number stay the same when the certificate is renewed?


回答1:


Combination of IssuerRDN (set of fields that identify the issuer) and SerialNumber fields uniquely identifies the certificate as per RFC 5280.

The RFC doesn't define, what happens if the certificate is re-issued, but I would assume that the serial number is changed. The reason is that the new certificate would differ from the previous one and as such it must be identified uniquely.

Consequently for your task the better approach would be to

  1. validate the certificate chain completely to ensure integrity and authenticity of the certificate
  2. check issuer name
  3. check subject name
  4. check key usage field.

This will ensure that the certificate is valid and authorized for this company, and at the same time this algorithm saves you from the mistake of checking for exactly one certificate (this mistake can lead to trouble if the certificate is revoked for whatever reason and replaced with a new one).



来源:https://stackoverflow.com/questions/17893039/what-to-use-to-check-for-a-specific-exe-file-signature

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!