Search code examples
certificatecode-signingsigntoolcertutil

Certutil repair Code Signing Certificate in CurrentUser not LocalMachine


So this is my first time having this problem last time my code signing certificate was installed correct and without problems this time however the private key flag is missing from my certificate and after searching for about an hour I found certutil -repairstore my "CertSerialNumber"

This is working if the certificate is installed to the local machine but then signtool is unable to find the certificate, by default it installed to CurrentUser so how do I run certutil -repairstore on a certificate on current user, i have tried adding -sr currentuser and -user and it complains they are invalid parameters (WIN32: 87 ERROR_INVALID_PARAMETER).


Solution

  • Finally fount the answer typical it's within mins of posting this question so for anyone else,

    make sure the param's are ordered correctly, the certutil is a little bit of a pain with order of parameters,

    certutil -user -repairstore my "CertSerialNumber"

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil