The specified file could not be signed

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

The specified file could not be signed

Post by DiZzyDmon »

Product, version and build: PrimalScript 2019 version 7.4.122, 64-bit
Operating system: Windows 10 1803, 64-bit

I have an Entrust code-signing certificate, which resides in my user profile's Personal > Certificates store. It is registered in PrimalScript via File > Options > Script Signing. I've been using this certificate for almost a year (since February 2018) in PrimalScript to sign my scripts. Never a problem until yesterday.

Now when I try to sign a script using PrimalScript 2019, no matter what file (.vbs or .ps1) I try to sign, even a brand new file with no code in it, as soon as I click the File > Sign button I get an error popup "The specified file could not be signed".

I do not know if this is the first time I have attempted to sign a script using the 2019 release of PrimalScript, but it might be.

I needed to rebuild my (virtual) computer anyway, to solve an unrelated problem. On this new computer, I installed PrimalScript 2019, installed the certificate, registered the certificate within PrimalScript, tried to use it. I get the same "The specified file could not be signed" error on this brand new machine.
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: The specified file could not be signed

Post by mxtrinidad »

Thanks for reporting the issue. Our support team will look into it and get back to you soon as possible.
User avatar
mxtrinidad
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: The specified file could not be signed

Post by mxtrinidad »

Under the Option menu, in the "Script Settings | Script Signing" section.
Use the Certificate button to find you certificate (See image)
Cert_issue_2019-01-10_17-05-33.jpg
Cert_issue_2019-01-10_17-05-33.jpg (85.97 KiB) Viewed 12675 times
Please, let us know if this solve the issue.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

Re: The specified file could not be signed

Post by DiZzyDmon »

File > Options > Script Settings > Script Signing > Certificate button is the way I have always registered my script signing certificate.

When I click the button, it raises a popup showing my script signing certificate.
My script signing certificate.png
My script signing certificate.png (94.52 KiB) Viewed 12663 times
I click "OK" in the popup, it goes away, and my certificate's name is listed in the "Certificate" box.

But when I click File > Sign, I get the "The specified file could not be signed" error.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: The specified file could not be signed

Post by Alexander Riedel »

A quick test here shows it works with our certificate. I know that doesn't help you, but let's find out what is different.
If you specify a certificate in your personal store, a password should not be required. So please try after deleting that password.
Secondly, you can also try to sign without specifying ANY certificate at all. That will use the first code signing certificate in your personal store.
While this might not be the one you want to use, please try and let us know what it does.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

Re: The specified file could not be signed

Post by DiZzyDmon »

I blanked out the password, removed the Certificate entry, no difference.

I'm going to try reverting to an older version of PrimalScript.
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Mon Mar 25, 2024 11:57 am

Re: The specified file could not be signed

Post by Olga_B »

Could you please check if your Certificate is not expired.
We tested Signing functionality here, and with correct certificate everything works fine.
The error will be displayed if:
- certificate expired
- certificate corrupted
- you are using .pfx file and provide wrong password

Could you check the script that was signed with that certificate and check through what date this certificate is valid
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: The specified file could not be signed

Post by Alexander Riedel »

I can see the certificate is not expired on the screenshot. Please let us know how your experiment with an older build goes.
We are preparing a new build with a more detailed error message (as far as system error messages go), maybe that will give us additional clues.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
DiZzyDmon
Posts: 73
Last visit: Thu Feb 29, 2024 8:01 am
Has voted: 1 time

Re: The specified file could not be signed

Post by DiZzyDmon »

To keep this update short, my final troubleshooting round was:
  • Uninstall all Sapien software
  • Delete all leftover Sapien files and registry entries
  • Delete my script signing certificate from Certificates - Current User > Personal > Certificates
  • Restart the computer
  • Install PrimalScript 7.4.112 (released February 27, 2018)
With all that, I still immediately get "The specified file could not be signed" as soon as I click File > Sign.

This error also occurs, in the exact same manner, on my physical laptop. I know I've used that laptop in the past to sign code via PrimalScript.

Whatever's going on may not be directly related to Sapien's software. I'm going to contact the person in our IT department who obtained my Entrust script signing certificate, see if he knows anything about any changes to how our organization allows certificate checking.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: The specified file could not be signed

Post by Alexander Riedel »

There are a number of different APIs available for code signing. It is also possible that a Windows update changed/botched something.

Try this from a powershell console:
$cert = @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0]
Set-AuthenticodeSignature <your_file>.ps1 $cert

and see if that also fails.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 5 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.