azuredevops-codesigning-task icon indicating copy to clipboard operation
azuredevops-codesigning-task copied to clipboard

Was not able to sign .crt file but I could sign the .pfx file

Open acrigney opened this issue 3 years ago • 5 comments

This was my error with no details.

Signing file: D:\a\r1\a_GENYX\drop\EasyPlexResultsNet48.Package_1.0.0.14_Debug_Test\EasyPlexResultsNet48.Package_1.0.0.14_AnyCPU_Debug.appxbundle 2021-11-11T02:05:23.3707501Z [command]D:\a_tasks\codesigning_0e0f3bf7-d96c-45d6-aa76-f9afb71fb77e\2.2.0\signtool.exe sign /fd SHA256 /t http://timestamp.digicert.com /f D:\a_temp\EasyPlexResultsNet48.Package_TemporaryKey.crt /p ausdx D:\a\r1\a_GENYX\drop\EasyPlexResultsNet48.Package_1.0.0.14_Debug_Test\EasyPlexResultsNet48.Package_1.0.0.14_AnyCPU_Debug.appxbundle 2021-11-11T02:05:23.6972993Z SignTool Error: An error occurred while attempting to load the signing 2021-11-11T02:05:23.6973851Z 2021-11-11T02:05:23.6974649Z certificate from: D:\a_temp\EasyPlexResultsNet48.Package_TemporaryKey.crt

acrigney avatar Nov 11 '21 01:11 acrigney

I ran it again and I got this error looks like this is the fix. 2021-11-11T02:38:37.7385069Z ========================== Starting Command Output =========================== 2021-11-11T02:38:37.7671844Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a_temp\3be544d0-9b0c-4677-a63b-124c37eda9b4.ps1'" 2021-11-11T02:38:38.4077005Z ##[error]Import-Certificate : Importing PFX files is not supported. Use Import-PfxCertificate to import PFX files. At D:\a_temp\3be544d0-9b0c-4677-a63b-124c37eda9b4.ps1:3 char:1

  • Import-Certificate -Filepath D:\a_temp\EasyPlexResultsNet48.Package_ ...

  • 
      + CategoryInfo          : NotSpecified: (:) [Import-Certificate], ArgumentException
    
      + FullyQualifiedErrorId : System.ArgumentException,Microsoft.CertificateServices.Commands.ImportCertificateCommand
    

acrigney avatar Nov 11 '21 02:11 acrigney

I exported the pfx certificate as AES256-SHA256 so my certificate file is now EasyPlexResultsNet48.Package_TemporaryKeySHA.crt But I still get the same error as before. It would be nice to get more descriptive errors? Is there any way I can debug this mate? SignTool Error: An error occurred while attempting to load the signing

Z SignTool Error: An error occurred while attempting to load the signing 2021-11-11T23:19:46.2126674Z 2021-11-11T23:19:46.2127129Z certificate from: D:\a_temp\EasyPlexResultsNet48.Package_TemporaryKeySHA.crt

acrigney avatar Nov 11 '21 23:11 acrigney

I created a selfsigned certifcate in Azure powershell and I got another error, must have generated the wrong type of certificate Signing file: D:\a\r1\a_GENYX\drop\EasyPlexResultsNet48.Package_1.0.0.15_Debug_Test\EasyPlexResultsNet48.Package_1.0.0.15_AnyCPU_Debug.appxbundle

2021-11-12T00:02:43.0910381Z [command]D:\a_tasks\codesigning_0e0f3bf7-d96c-45d6-aa76-f9afb71fb77e\2.2.0\signtool.exe sign /fd SHA256 /t http://timestamp.digicert.com /f D:\a_temp\selfsigncert.crt /p ausdx D:\a\r1\a_GENYX\drop\EasyPlexResultsNet48.Package_1.0.0.15_Debug_Test\EasyPlexResultsNet48.Package_1.0.0.15_AnyCPU_Debug.appxbundle 2021-11-12T00:02:43.7339114Z SignTool Error: No certificates were found that met all the given criteria.

acrigney avatar Nov 12 '21 00:11 acrigney

Any help would be really great.

acrigney avatar Nov 18 '21 23:11 acrigney

Hi @acrigney,

I am very sorry for the delay.

Are you running the Build Agent on a Hosted Agent or is it a Self Hosted Agent? In both cases it might be a problem with locating the right path for the signtool. Can you add further details on the configured settings?

StefanKert avatar Nov 21 '21 17:11 StefanKert