Page 1 of 2

The specified file could not be signed

Posted: Thu Jan 10, 2019 1:23 pm
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.

Re: The specified file could not be signed

Posted: Thu Jan 10, 2019 1:50 pm
by mxtrinidad
Thanks for reporting the issue. Our support team will look into it and get back to you soon as possible.

Re: The specified file could not be signed

Posted: Thu Jan 10, 2019 2:15 pm
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 12724 times
Please, let us know if this solve the issue.

Re: The specified file could not be signed

Posted: Thu Jan 10, 2019 5:45 pm
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 12712 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.

Re: The specified file could not be signed

Posted: Thu Jan 10, 2019 9:43 pm
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.

Re: The specified file could not be signed

Posted: Fri Jan 11, 2019 8:31 am
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.

Re: The specified file could not be signed

Posted: Fri Jan 11, 2019 1:16 pm
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

Re: The specified file could not be signed

Posted: Fri Jan 11, 2019 10:26 pm
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.

Re: The specified file could not be signed

Posted: Sat Jan 12, 2019 6:26 am
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.

Re: The specified file could not be signed

Posted: Sat Jan 12, 2019 7:13 am
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.