I’m trying to sign a Windows 8 appx package with a pfx file I have. I’m using a command like so:
signtool.exe sign /fd sha256 /f "key.pfx" "app.appx"
And from this, I get:
SignTool Error: No certificates were found that met all the given criteria.
What «criteria» am I not meeting? This is only for testing so these are self-signed certificates. I’ve tried importing the key and then signing it, but it always results in the same error. How do I fix this?
asked Apr 8, 2014 at 19:25
3
When getting this error through Visual Studio it was because there was a signing certificate setup to match the computer it was originally developed on.
You can check this by going to the project properties > signing tab and checking the certificate details.
You can uncheck «Sign the ClickOnce manifests» to disable signing.
If you don’t want to turn this option off you will have to install the certificate.
answered Dec 16, 2014 at 14:55
JDandChipsJDandChips
9,5203 gold badges29 silver badges46 bronze badges
8
Try with /debug.1,2 As in :
signtool sign /debug /f mypfxfile.pfx /p <password> (mydllexectuable).exe
It will help you find out what is going on. You should get output like this:
The following certificates were considered:
Issued to: <issuer>
Issued by: <certificate authority> Class 2 Primary Intermediate Server CA
Expires: Sun Mar 01 14:18:23 2015
SHA1 hash: DD0000000000000000000000000000000000D93E
Issued to: <certificate authority> Certification Authority
Issued by: <certificate authority> Certification Authority
Expires: Wed Sep 17 12:46:36 2036
SHA1 hash: 3E0000000000000000000000000000000000000F
After EKU filter, 2 certs were left.
After expiry filter, 2 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.
You can see what filter is causing your certificate to not work, or if no certificates were considered.
I changed the hashes and other info, but you should get the idea.
1 Please note: signtool
is particular about where the /debug
option is placed. It needs to go after the sign
statement.
2 Also note: the /debug
option only works with some versions of signtool
. The WDK version has the option, whereas the Windows SDK version does not.
user
4,9456 gold badges17 silver badges35 bronze badges
answered Apr 14, 2014 at 4:26
DanielDaniel
1,6951 gold badge9 silver badges4 bronze badges
7
I got the same problem in my console application development and as a quick workaround,
go to project properties
then,
click on signing
tab and uncheck «Sign the ClickOnce Manifest».
Image Description:
FYI You can also see this less one minute video solution. The above picture is taken form the video.
answered Nov 12, 2019 at 4:49
5
Please always check your certificate expiry date first because most of the certificates have an expiry date. In my case certificate has expired and I was trying to build project.
Hakan Fıstık
15.9k12 gold badges103 silver badges127 bronze badges
answered Oct 19, 2015 at 10:28
whizkidwhizkid
4314 silver badges4 bronze badges
1
If you do not have to sign the app, right click on your project
Project Properties -> Signing -> uncheck "Sign the ClickOnce Manifest"
Also as this MS article suggests,
If you are using Visual Studio 2008 and are targeting .NET 3.5 and using automatic updates, you can just change the certificate and deploy a new version,
answered Jan 17, 2019 at 3:07
nPcompnPcomp
8,0521 gold badge53 silver badges48 bronze badges
1
In my case I have the wrong type of certificate that I am trying to associate.
I had «Server Authentication» rather than «Code signing».
You should be able to see this in Certificate snap in the Intended Purpose section.
After that, it just work fine.
Hakan Fıstık
15.9k12 gold badges103 silver badges127 bronze badges
answered Oct 22, 2014 at 15:51
maridobmaridob
6515 silver badges21 bronze badges
3
Got the same issue, turned out that the private key to the certificate had no permission.
To fix — open the certifacte management, find your certificate, right click -> Manage Private Keys and then in security on top be sure that your user is added and given permissions, that fixed it for me.
Hakan Fıstık
15.9k12 gold badges103 silver badges127 bronze badges
answered Nov 21, 2014 at 16:12
In case anyone else runs into this: My problem ended up being that I needed to run the command prompt as administrator before using the signtool.exe app. Then everything works wonderfully.
answered Aug 20, 2014 at 14:15
DaveDave
8998 silver badges8 bronze badges
2
just uncheck the ‘Sign the click once manifests’ from the signing tab in project properties,it will remove the error and you can create a new one as from there.
answered Jan 21, 2018 at 5:43
0
I had this problem and I’m not entirely sure which step below made it work, but hope this helps somebody else…this is what I did:
- Install the downloaded certificate (.crt) into certificates (I put it into “personal” store) — right click on .crt file and click Install Certificate.
- Run
certmgr.msc
and export the certificate (found in whichever store you used in the 1st step) as a pfx file including private key and extended properties - Use the exported .pfx file when signing your project
- Example signtool:
signtool sign /f "c:mycert.pfx" /p mypassword /d "description" /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetPath)
where the password is the same as provided during Export
answered Feb 15, 2018 at 14:54
noelicusnoelicus
14.2k2 gold badges90 silver badges109 bronze badges
3
I solved this by using the /sm
flag to specify to look in the machine store instead of the default, which is My (Local User) store. Also, it can help to turn on debug for signtool by using /debug
.
answered May 23, 2017 at 19:20
jlejle
9,2185 gold badges48 silver badges67 bronze badges
I’m having the same problem, reading some answers (posted here), I saw my certificate expired.
Just create a new one from my start project. Then at certificates manager deleted the expired certificate.
Now everything compiles fine.
Hakan Fıstık
15.9k12 gold badges103 silver badges127 bronze badges
answered Aug 15, 2016 at 22:16
Juan Pablo GomezJuan Pablo Gomez
5,00610 gold badges52 silver badges94 bronze badges
The criteria include account name (whose private key it is associated with), domain, company, expiration date, intended purposes, among other things.
There are many different possible reasons for this error to occur, some have been listed already. Here is another tip: When importing a certificate, be sure you work with the original file received from the certificate authority (CA), or else some of the properties might be lost.
Example: recently I tried to import a certificate exported from a different account on the same machine. The certificate became visible to my account but was not associated with my account, and as a result signtool
refused to recognize it without explicitly providing the file name and a password. Which, when done as part of the build process and written out explicitly in a batch file or source file, may not be sufficiently secure. (Importing the original CA-issued certificate solved it.)
answered Feb 5, 2015 at 21:34
I had the same «After Private Key filter, 0 certs were left» message and spent too much of my life trying to figure out what the message meant.
The problem was that I had installed the certificate incorrectly in the Windows Certificate store so there was no private key associated with the code signing certificate.
What I should have done was this:
-
Using either Firefox or Internet Explorer, submit the
request to the issuer. This generates a PRIVATE KEY which is stored silently by the browser (a dialog appears for a fraction of a second in Firefox). Note that other browsers may not work: your life is too short to find out if they do. -
Submit the request, jump through the issuer’s validation hoops and loops, sacrifice a goat, pray to the gods, submit a signed statement from your great grandparents, etc.
-
Download the certificate (.crt) and import it into the same browser. The browser now has both the private key and the certificate.
-
Export the certificate from the browser as a Personal Information Exchange (.p12) file. You will be asked to supply a password to protect this file.
-
Keep a backup copy of the .p12 file.
-
Run the Certificate Manager (certmgr.msc), right click on the Personal certificate store, select All Tasks/Import… and import the .p12 file into Windows. You will be asked for the password you used to protect the file. At this point, depending upon your security requirements, you can mark the key as exportable so you can restore a copy from the Windows store. You can also mark that a password is required before use if you want to break batch scripts.
-
Run signtool successfully, breathe a sigh of relief, and ponder how much of your life you have wasted due to bad error messages and poor or missing documentation.
answered Feb 12, 2019 at 21:54
MZBMZB
2,0412 gold badges21 silver badges38 bronze badges
0
My problem ended up being that I did not understand the signtool options. I had provided the /n option with something that did not match my certificate. When I removed that it stopped complaining.
answered Oct 31, 2016 at 6:26
SilwingSilwing
3302 silver badges11 bronze badges
I have had this issue too, tried a lot. Used SDK as well as Visual Studio signing, but everywhere I got «No certificates were found that met all the given criteria».
Solution:
Be aware that, if «after private key filter»: ‘0 left’ shows up with option signtool sign /debug…, the cause is your PC doesn’t has the CA itself in the store. To solve this, install the CA first (in my case a .crt file), then run the sign again. It should work right now!
Signtool only can be used with a CA which is requested ánd owned by the same PC.
answered Jun 15, 2016 at 8:51
1
I had a similar problem my computer name had change and the certificate had expired. I was able to resolve this issue by creating a new test certificate.
In Visual Studio, right click on project in solution explorer. Select properties. Select Signing in properties window. Click «Create Test Certificate….». Enter password information for test certificate and click ok.
answered Apr 26, 2017 at 13:59
nate_weldonnate_weldon
2,2891 gold badge25 silver badges32 bronze badges
With /debug, when you get this message «After Private Key filter, 0 certs were left.», one reason could be that the pfx file doesn’t have the private key.
When you export the installed certificate to pfx file ensure to enable the check box to also include the private key.
answered Jul 4, 2017 at 10:14
Go to project properties
and uncheck all fields from the Firm
before init the compilation
fedorqui
266k101 gold badges536 silver badges590 bronze badges
answered Nov 19, 2014 at 15:29
The digicert Token I use, must be recognized as «Microsoft Usbccid-Smartcard-Leser(WUDF)».
In case not, I get this error message ‘No certificates were found that met all given criteria …’.
That kept me searching in SignTool options and the properties of the certificates quite long with no effort at all. So I hope it helps someone
answered Feb 23, 2022 at 16:11
I got this error when using Git Bash
.
Using PowerShell
succeeded.
If it helps anyone.
answered Jun 8, 2022 at 8:46
1
- Remove From My Forums
-
Question
-
Hello, i’m always encountering this error (as in the title) when sign an dll file. I have use ‘mmc->certmgr.msc’ to verify and confirm that i do have the required certificate… any idea why i’m still encountering this error?
-
Moved by
lake Xiao
Friday, August 5, 2016 5:57 AM
-
Moved by
All replies
-
Hi Andes,
There are few things that can go wrong here:
1) Check if the Certificate you are using is not expired
2) Check if you are running cmd prompt as Administrator whenever trying to invoke signtool.
3) Check if the private keys for your certificate is set correctly and the permissions for same (via cert management console) are set appropriately.
Please mark the post as Answered if this resolves the issue.
Cheers !
Chirag
-
Proposed as answer by
.ChiragDave
Thursday, August 4, 2016 10:18 AM
-
Proposed as answer by
-
Hi Chirag,
Thank you for your reply.
For 1 & 2, I’m pretty sure it is not expired and I’m using the cmd prompt with the administrator privilege.
But for 3, I’m just not sure how to check the private key and permission of the certificate in certmgr.msc? i couldn’t find anything like mentioned in the property of the related
certificate.. -
hmmm… i thought signtool.exe is part of visual studio, isn’t it?
anyway, i hope somebody out there from microsoft can help me to resolve this issue…
-
any response from anybody from microsoft support?
-
quite disappointing…
somebody already started to provide assistance to my issue..
but then somebody just anyhow moved it to another forum…
and then just nobody replies to the thread any more…
disappointing support…
-
Hi Andes,
Sorry for late reply.
>>»I’m just not sure how to check the private key and permission of the certificate in certmgr.msc»
Which certificate did you use to sign the dll? You could press [Windows+R] to open Run window, then input certmgr.msc and press [Enter]. A Certificates window will popup. Please mark sure your certificate has been installed and has been trusted
by current user. If the certificate has not been installed, you could use following steps to import the certificate.In Certificates Window -> Click [Action] menu -> [All Tasks] -> [Import]…
Best Regards,
Li Wang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi Li Wang,
Yes, my certificate has been installed and has been trusted by current user.
-
Hi Andes,
Thank you for your feedback.
Please add a /debug option to signtool command. It will show the detail information of sign steps. We will see what filter is causing your certificate not work.
signtool sign /debug
Best Regards,
Li Wang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi Li Wang,
below is the outcome:
The following certificates were considered:
… <list of all the certificates> …
After EKU filter, 0 certs were left.
After expiry filter, 0 certs were left.
After Subject Name filter, 0 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.it’s a bit strange, in the output list of the certificates, i really cannot find the specific certificate (name AAA). but in «certmgr.msc»—>»Certificates
— Current User»—>»Trusted Publishers»—>»Certificates», i do see the certificate (name AAA).I checked the command output listed certificates. only the ones under «certmgr.msc»—>»Certificates
— Current User»—>»Personal»—>»Certificates» are listed. all certificates under other folders (seen in certmgr.msc) are not listed out in the command output. why is it like that?if i export the certificate from «Trusted Publishers» and import it into «Personal» folder, and try the command again, below is the output:
After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Subject Name filter, 1 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.Could you please advise me how to troubleshoot further?
Thanks.
-
Edited by
Andes Law
Thursday, August 11, 2016 3:22 AM
-
Edited by
-
«After Subject Name filter, 1 certs were left.
After Private Key filter, 0 certs were left.«
This might mean there is a difference between Private Key mentioned in query and the one on certificate. But unfortunately, this is also one of the most commonly reported wrong message by SignTool.
Can you try searching for other instances of SignTool.exe on your machine or try other steps mentioned as in below post :
http://stackoverflow.com/questions/28690986/code-signing-with-signtool-fails-due-to-private-key-filter
Let me know what you find.
Cheers !
Chirag Dave
-
I have searched a few instances of SignTool.exe on my machine. And I have tried to use each individual signtool.exe to do the code signing and the result is the same.
I have also read the above mentioned thread. basically it says it was due to the path environment variable messed up. I have tried in the command prompt, to set the path variable to empty. but signtool still has the same error.
-
hmm…
nobody is providing any help again…
hmm…
-
Any solutions to this? Im having the same issue.
-
Thank you..It resloved my issue.
I’m getting this error too. @develar @logidelic @jolamar
Version: 21.2.0
I’m running Windows 10 in Parallels Pro and am using a self-signed certificate which I imported into:
- Root Certificated Authorities
- Trusted Publishers
- Trusted People
I can sign the appx if I remove the the «win» segment from config. Electron builder reports success. However, if I check the resulting appx file in windows inspector, the «Digital Signatures» tab is missing from «Properties» panel.
If the «win» section is present, the build fails and I get the «No certificates…» error.
My config:
win: {
icon: './public/icons/icon.ico',
artifactName: '${productName}-${version}-win64.${ext}',
publisherName: 'Me',
certificateSubjectName: 'Me',
target: [
{
target: 'nsis',
arch: ['x64', 'ia32'],
},
{
target: 'appx',
arch: ['x64'],
},
],
},
appx: {
identityName: 'App',
displayName: 'App',
publisher: 'CN=something',
publisherDisplayName: 'Me',
languages: [
'en_US',
'hu_HU'
],
addAutoLaunchExtension: true,
setBuildNumber: true,
backgroundColor: 'lightGray'
},
The certificate is fine. I can run this in powershell:
Set-AuthenticodeSignature -FilePath '.some.file' -Certificate $cert
and it works. And if I inspect that file, it has «Digital Signatures» panel.
I generated the certificate like this:
$cert = New-SelfSignedCertificate -Subject "Me" -Type CodeSigningCert -CertStoreLocation cert:LocalMachineMy
$CertPassword = ConvertTo-SecureString -String "foo" -Force -AsPlainText
Export-PfxCertificate -Cert cert:LocalMachineMysomeid -FilePath cert.pfx -Password $CertPassword
What’s wrong? Why does electron builder report success when the resulting file is actually not signed according to windows.
Thanks in advance!
I’m trying to sign a Windows 8 appx package with a pfx file I have. I’m using a command like so:
signtool.exe sign /fd sha256 /f "key.pfx" "app.appx"
And from this, I get:
SignTool Error: No certificates were found that met all the given criteria.
What «criteria» am I not meeting? This is only for testing so these are self-signed certificates. I’ve tried importing the key and then signing it, but it always results in the same error. How do I fix this?
19 Answers
When getting this error through Visual Studio it was because there was a signing certificate setup to match the computer it was originally developed on.
You can check this by going to the project properties > signing tab and checking the certificate details.
You can uncheck «Sign the ClickOnce manifests» to disable signing.
If you don’t want to turn this option off you will have to install the certificate.
Try with /debug.1,2 As in :
signtool sign /debug /f mypfxfile.pfx /p <password> (mydllexectuable).exe
It will help you find out what is going on. You should get output like this:
The following certificates were considered:
Issued to: <issuer>
Issued by: <certificate authority> Class 2 Primary Intermediate Server CA
Expires: Sun Mar 01 14:18:23 2015
SHA1 hash: DD0000000000000000000000000000000000D93E
Issued to: <certificate authority> Certification Authority
Issued by: <certificate authority> Certification Authority
Expires: Wed Sep 17 12:46:36 2036
SHA1 hash: 3E0000000000000000000000000000000000000F
After EKU filter, 2 certs were left.
After expiry filter, 2 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.
You can see what filter is causing your certificate to not work, or if no certificates were considered.
I changed the hashes and other info, but you should get the idea. Hope this helps.
1Please note: signtool
is particular about where the /debug
option is placed. It needs to go after the sign
statement.
2Also note: the /debug
option only works with some versions of signtool
. The WDK version has the option, whereas the Windows SDK version does not.
I got the same problem in my console application development and as a quick workaround,
go to project properties
then,
click on signing
tab and uncheck «Sign the ClickOnce Manifest».
Image Description:
FYI You can also see this less one minute video solution. The above picture is taken form the video.
Please always check your certificate expiry date first because most of the certificates have an expiry date. In my case certificate has expired and I was trying to build project.
If you do not have to sign the app, right click on your project
Project Properties -> Signing -> uncheck "Sign the ClickOnce Manifest"
Also as this MS article suggests,
If you are using Visual Studio 2008 and are targeting .NET 3.5 and using automatic updates, you can just change the certificate and deploy a new version,
In my case I have the wrong type of certificate that I am trying to associate.
I had «Server Authentication» rather than «Code signing».
You should be able to see this in Certificate snap in the Intended Purpose section.
After that, it just work fine.
just uncheck the ‘Sign the click once manifests’ from the signing tab in project properties,it will remove the error and you can create a new one as from there.
Got the same issue, turned out that the private key to the certificate had no permission.
To fix — open the certifacte management, find your certificate, right click -> Manage Private Keys and then in security on top be sure that your user is added and given permissions, that fixed it for me.
In case anyone else runs into this: My problem ended up being that I needed to run the command prompt as administrator before using the signtool.exe app. Then everything works wonderfully.
I solved this by using the /sm
flag to specify to look in the machine store instead of the default, which is My (Local User) store. Also, it can help to turn on debug for signtool by using /debug
.
I had this problem and I’m not entirely sure which step below made it work, but hope this helps somebody else…this is what I did:
- Install the downloaded certificate (.crt) into certificates (I put it into “personal” store) — right click on .crt file and click Install Certificate.
- Run
certmgr.msc
and export the certificate (found in whichever store you used in the 1st step) as a pfx file including private key and extended properties - Use the exported .pfx file when signing your project
- Example signtool:
signtool sign /f "c:mycert.pfx" /p mypassword /d "description" /t http://timestamp.verisign.com/scripts/timstamp.dll $(TargetPath)
where the password is the same as provided during Export
I’m having the same problem, reading some answers (posted here), I saw my certificate expired.
Just create a new one from my start project. Then at certificates manager deleted the expired certificate.
Now everything compiles fine.
The criteria include account name (whose private key it is associated with), domain, company, expiration date, intended purposes, among other things.
There are many different possible reasons for this error to occur, some have been listed already. Here is another tip: When importing a certificate, be sure you work with the original file received from the certificate authority (CA), or else some of the properties might be lost.
Example: recently I tried to import a certificate exported from a different account on the same machine. The certificate became visible to my account but was not associated with my account, and as a result signtool
refused to recognize it without explicitly providing the file name and a password. Which, when done as part of the build process and written out explicitly in a batch file or source file, may not be sufficiently secure. (Importing the original CA-issued certificate solved it.)
I had the same «After Private Key filter, 0 certs were left» message and spent too much of my life trying to figure out what the message meant.
The problem was that I had installed the certificate incorrectly in the Windows Certificate store so there was no private key associated with the code signing certificate.
What I should have done was this:
-
Using either Firefox or Internet Explorer, submit the
request to the issuer. This generates a PRIVATE KEY which is stored silently by the browser (a dialog appears for a fraction of a second in Firefox). Note that other browsers may not work: your life is too short to find out if they do. -
Submit the request, jump through the issuer’s validation hoops and loops, sacrifice a goat, pray to the gods, submit a signed statement from your great grandparents, etc.
-
Download the certificate (.crt) and import it into the same browser. The browser now has both the private key and the certificate.
-
Export the certificate from the browser as a Personal Information Exchange (.p12) file. You will be asked to supply a password to protect this file.
-
Keep a backup copy of the .p12 file.
-
Run the Certificate Manager (certmgr.msc), right click on the Personal certificate store, select All Tasks/Import… and import the .p12 file into Windows. You will be asked for the password you used to protect the file. At this point, depending upon your security requirements, you can mark the key as exportable so you can restore a copy from the Windows store. You can also mark that a password is required before use if you want to break batch scripts.
-
Run signtool successfully, breathe a sigh of relief, and ponder how much of your life you have wasted due to bad error messages and poor or missing documentation.
My problem ended up being that I did not understand the signtool options. I had provided the /n option with something that did not match my certificate. When I removed that it stopped complaining.
I have had this issue too, tried a lot. Used SDK as well as Visual Studio signing, but everywhere I got «No certificates were found that met all the given criteria».
Solution:
Be aware that, if «after private key filter»: ‘0 left’ shows up with option signtool sign /debug…, the cause is your PC doesn’t has the CA itself in the store. To solve this, install the CA first (in my case a .crt file), then run the sign again. It should work right now!
Signtool only can be used with a CA which is requested ánd owned by the same PC.
I had a similar problem my computer name had change and the certificate had expired. I was able to resolve this issue by creating a new test certificate.
In Visual Studio, right click on project in solution explorer. Select properties. Select Signing in properties window. Click «Create Test Certificate….». Enter password information for test certificate and click ok.
With /debug, when you get this message «After Private Key filter, 0 certs were left.», one reason could be that the pfx file doesn’t have the private key.
When you export the installed certificate to pfx file ensure to enable the check box to also include the private key.
Go to project properties
and uncheck all fields from the Firm
before init the compilation
beginer
324
87 |
I’m trying to publish the wpf project and getting following error
Earlier it was working fine. Views: |
Answers
Rahul M…
1416
238 |
The error comes due to SignIn tool not able to found the certificate or the certificate expired. To See if the certificate is expired or not, open project properties and go to Signing in Left menu. See below: Solution: I) Create a new certificate and select from file. II) Create a new wpf project and copy the certificate from the root project folder and paste in the current project and rename it. Posted On: |
Suren M…
2
1 |
I had a similar issue and found a solution. Please look into this article. Posted On: |
Discussion
Blog
Active User (0)
|
|