Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

MSI signing using the wrong certificate

Hello,

Since I'm doing a lot of work that has to do with security, I have many X509 certificates installed in my local certificate store, including several expired code signing certifcates.

I have a package that uses a certificates that has several expired version (same name, different keys, hash and expirations) installed as well.

Unfortunately, Advanced installer seems unable to pick the right certificate: even though the UI only lists the valid certificate in the dropdown, the actual process clearly uses the name and not the hash for identifying the certificate because it always picks the wrong one and the signature fails. I need to keep these certificates even though they are technically invalid so deleting them isn't a solution.

As a workaround, I'm using signtools to sign and timestamp the MSI but that forces added complication to the whole build process.
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: MSI signing using the wrong certificate

Hello,

To be honest with you, I have not faced this scenario in the past, so I can not really give a conclusive answer.

If possible, could you please share with me those two certificates and a small test-case by email at support at advancedinstaller dot com so I can further investigate and test this on our end?

If sharing the certificates is not possible, please create two sample certificates that you can reproduce this problem with and forward me those instead.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: MSI signing using the wrong certificate

Hello and thank you for your answer

I'm afraid I can't provide you with the production certificates but I will send you a couple of self-signed certs that I could use to reproduce the issue somewhat: I can reproduce it when selecting "pick the most suited certificate" but not when explicitely selecting one.

I strongly suspect that the issue is caused by the use of an unsorted list which causes the issue to be interrmitent: depending on the order the certificates gets listed, the correct cert will or will not be picked pretty much at random.

Of course, if the certificate was selected through the signature instead of the name, the problem wouldn't be there.

Anyway, I will send you the two test certs that I used.
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: MSI signing using the wrong certificate

Hello,

Thank you for the provided resources.

This is currently under our investigation and I will followup as soon as I will have a conclusive answer.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: MSI signing using the wrong certificate

Hello,

First of all, thank you for the provided certificates.

I did some tests on my end and I indeed managed to reproduce the behavior you mentioned - the one where the expired certificate is picked.

However, I did not manage to reproduce the other one where you specifically select the good certificate and the expired one is used instead.

Please note that, for signing purposes, we use a third party tool from Microsoft (SignTool). This is the tool that is picking the certificate through its command line parameter: "/a"

https://docs.microsoft.com/en-us/dotnet ... gntool-exe
/a - "Automatically selects the best signing certificate. [...]"
Now, why the tool behaves like this, I can not really tell, since the tool is not proprietary to us.

To overcome this, I do not really see a solution besides the "Use file from disk" option, that will let you pick the specific certificate.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”