AL icon indicating copy to clipboard operation
AL copied to clipboard

Signing app leads to "This file format cannot be signed because it is not recognized" error

Open kine opened this issue 8 years ago • 6 comments

Hello all, wanted to sign the app with the signtool on my server during the CI/CD, but still getting "This file format cannot be signed because it is not recognized" even when the Install-NAVSipCryptoProviderFromNavContainer was used. Signing on my desktop works.

What I installed on the server>

  1. VS 2017 community - Windows 10 SDK (10.0.16299.0) for UWP: C#, VB, JS
  2. Used the Install-NAVSipCryptoProviderFromNavContainer for container based on microsoft/bcsandbox image
  3. Tried to do signtool.exe to sign the app.

Getting this in cmd>

C:\Windows\system32>SignTool sign /f \\devel\templates\build\NVRCodeSigning.p12 /p ****** /t http://timestamp.verisign.com/scripts/timestamp.dll "filename"
Done Adding Additional Store
SignTool Error: This file format cannot be signed because it is not recognized.
SignTool Error: An error occurred while attempting to sign: filename

Number of errors: 1

What could be wrong in this?

kine avatar May 10 '18 11:05 kine

I have only seen this error in cases where the correct navsip.dll was not installed. Can you make sure that the only navsip.dll on your build machine is the one coming from NAV 2018 or later?

StanislawStempin avatar May 11 '18 12:05 StanislawStempin

Have checked the machine, and I only found the navsip.dll in System32 folder (size 40640, version 11.0.21836.0) and in SysWOW64 (size 36032, version 11.0.21836.0). Of course, it found many other in docker windowsfilter folder, where are files for the docker images...

kine avatar May 16 '18 05:05 kine

2018-05-30 1 I'm getting the exact same issue within a docker that I've installed in my Azure account. I'm trying to keep this as simple as possible, so I have signtool.exe, my code signing certificate, and my .app all in the same folder. I created this VM and installed this docker image in April, 2018.

C:\Users\vmadmin\Documents>signtool sign /t http://timestamp.verisign.com/scripts/timestamp.dll "C:\Users\vmadmin\Documents\Professional Business Software, Inc._247 TimeTracker_11.0.0.1.app" Done Adding Additional Store SignTool Error: This file format cannot be signed because it is not recognized. SignTool Error: An error occurred while attempting to sign: C:\Users\vmadmin\Documents\Professional Business Software, Inc._247 TimeTracker_11.0.0.1.app

Number of errors: 1

DaveBoehmPBSI avatar May 30 '18 17:05 DaveBoehmPBSI

As an update, I installed the latest version of NAV on my own computer, and code signing worked without a problem. On my computer it works, in the Azure docker image it doesn't. Just something to be aware of...

DaveBoehmPBSI avatar Jun 04 '18 17:06 DaveBoehmPBSI

As @StanislawStempin stated in his comment, this is due to NavSip.dll, its correct.

@kine , as you are using docker and signing file from you local machine, you are facing this issue.

I have done below and issue is resolved.

Solution :

  1. Try to copy file from docker image to your machine.
  • C:\Windows\System32\NavSip.dll
  • C:\Windows\syswow64\NavSip.dll
  1. Once copied to your local machine under below path for respective DLL ,
  • C:\Windows\System32\NavSip.dll
  • C:\Windows\syswow64\NavSip.dll
  1. Run powershell command again.

chavansachin20 avatar Jun 19 '18 11:06 chavansachin20

Interesting, I did same as before today, and it worked. Before I tried same x times. Just did Install-NAVSipCryptoProviderFromNavContainer -containerName xxx again and than the signtool worked. And I have checked that the dlls are where they should be today. After the install-navsip… command runned again today, all worked. Something rotten in the world of 0 and 1...

Seems solved for now. Will try as part of the CI/CD...

kine avatar Jun 19 '18 14:06 kine