Code Signing Fails with: Invalid algorithm specified

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 6 months 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
swisscard
Posts: 8
Last visit: Mon Mar 04, 2024 5:38 am

Code Signing Fails with: Invalid algorithm specified

Post by swisscard »

Product, version and build: PowerShell Studio 2018 (5.5.154)
32 or 64 bit version of product: 64Bit
Operating system:Windows 8.1
32 or 64 bit OS: 64Bit

After upgrading form PowerShell Studio 2018 (5.5.152 -> 5.5.154) Code signing fails with error
Error Signing File: C:\.................ps1
Invalid algorithm specified
If I do the signing manually through our internal code signing powershell script everything works fine. Most important parts of this scripts are:
  1. $SigningCert = (Get-ChildItem -Path cert:\CurrentUser\my -CodeSigningCert | where FriendlyName -eq "Company Code Signing Certificate")[0]
  2. Set-AuthenticodeSignature -filepath $File -certificate $SigningCert -IncludeChain All -TimeStampServer "http://timestamp.globalsign.com/scripts/timstamp.dll"

Under Options->Powershell we use exact the same Certificate and the same TimeStamp URL as in the script.
It just doesn't work from within the IDE (5.5.154).

As I can see there are other users having problems with code signing. There must be something broken in 5.5.154.

Could you please invstigate this ?

Regards,
Oliver
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Code Signing Fails with: Invalid algorithm specified

Post by davidc »

Do you have a Windows 10 system that you can test the certificate signing with?

We now use a higher encryption level and it could be that your system doesn't support it. This can happen if the OS isn't up to date.

In the meantime, we will try to recreate this on a Windows 8.1 machine. Can you provide the build number of your Windows 8.1 machine?

Thank you
David
SAPIEN Technologies, Inc.
User avatar
swisscard
Posts: 8
Last visit: Mon Mar 04, 2024 5:38 am

Re: Code Signing Fails with: Invalid algorithm specified

Post by swisscard »

Hi...

No, we don't have a Windows 10 build yet. We will start the Project soon.

The current Version of my System is: 6.3.9600 (Windows 8.1 64 Bit). OS is patched Weekly
.NET Version installed
PSChildName                      Version        Release Product
-----------                      -------        ------- -------
v2.0.50727                       2.0.50727.4927                
v3.0                             3.0.30729.4926                
Windows Communication Foundation 3.0.4506.4926                 
Windows Presentation Foundation  3.0.6920.4902                 
v3.5                             3.5.30729.4926                
Client                           4.6.01055      394271  4.6.1  
Full                             4.6.01055      394271  4.6.1  
Client                           4.0.0.0                       
Regards,
Oliver
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Code Signing Fails with: Invalid algorithm specified

Post by davidc »

Please view the properties of your certificate and under the Details tab, check the Signature algorithm and Signature hash algorithm values. What values you have for those fields?
David
SAPIEN Technologies, Inc.
User avatar
swisscard
Posts: 8
Last visit: Mon Mar 04, 2024 5:38 am

Re: Code Signing Fails with: Invalid algorithm specified

Post by swisscard »

Signature algorithm: sha256RSA
Signature hash algorithm: sha256

So everything up to date :-)
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Code Signing Fails with: Invalid algorithm specified

Post by davidc »

We have a similar encoded certificate and are unable to reproduce this issue. Let me pass this back to the dev team.
David
SAPIEN Technologies, Inc.
User avatar
swisscard
Posts: 8
Last visit: Mon Mar 04, 2024 5:38 am

Re: Code Signing Fails with: Invalid algorithm specified

Post by swisscard »

OK. Thanks for Investigation.

As I mentioned. Using PowerShell "Set-AuthenticodeSignature"-CmdLet withthe same Certificate works fine.
But it is annoying to always call the command separately :-)

Regards
Oliver
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Code Signing Fails with: Invalid algorithm specified

Post by davidc »

You can use the "External Signing Tool" setting in Options->PowerShell->Signing, to call powershell.exe and pass it the necessary command. This way you need not call invoke the command separately.
David
SAPIEN Technologies, Inc.
User avatar
swisscard
Posts: 8
Last visit: Mon Mar 04, 2024 5:38 am

Re: Code Signing Fails with: Invalid algorithm specified

Post by swisscard »

That worked....
powershell.exe -noprofile -command "$SigningCert = (Get-ChildItem -Path cert:\CurrentUser\my -CodeSigningCert | where FriendlyName -eq 'Company Code Signing Certificate')[0]; Set-AuthenticodeSignature -filepath %File% -certificate $SigningCert -IncludeChain All -TimeStampServer 'http://timestamp.globalsign.com/scripts/timstamp.dll'"
But it is not as nice as the builtin mechanism....

Regards,
Oliver
This topic is 5 years and 6 months 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.