AzureSignTool icon indicating copy to clipboard operation
AzureSignTool copied to clipboard

Files to sign to support wildcards

Open andyfisher100 opened this issue 1 year ago • 3 comments

It would be nice if the file to sign could support wildcard signing to sign multiple files from one command such as the following to sign multiple msi files in the same directory C:\BuildOutput\*.msi

This is something that is supported by sign tool itself and would makes life a little easier.

I do realise that the app supports the passing of a file that can contain multiple files to sign, maybe you suggestion is this instead of using wildcards?

andyfisher100 avatar Sep 06 '23 14:09 andyfisher100

Yes, it will surely help to support wildcard. As I need to sign all "exe" files in artifact.

malikirfan avatar Nov 08 '23 17:11 malikirfan

Any thoughts on implementing this. We have an electron build that puts the version number into the file name..... so its dynamic...

johnhydemtm365 avatar Jan 08 '24 11:01 johnhydemtm365

You can use a powershell script to get all files with a wildcard and then use that file as input for the AzureSignTool (option -ifl). You can configure that with a powershell command in an azure yaml. Here is my powershell code as example:

param([string] $toSignFile)

# Get the current folder
$currentFolder = Get-Location

# Specify the subfolder path
$subfolderPath = "subpathtoyourexe\*"
$targetFolderPath = Join-Path $currentFolder $subfolderPath
Write-Output "Finding signature files at $targetFolderPath"

# Find all .exe and .dll files in the specified subfolder
$files = Get-ChildItem -Path $targetFolderPath -Include *.exe,*.dll
Write-Output "All files found $files"

# Specify the output file path
$outputFilePath = Join-Path $currentFolder $toSignFile

# Write the file names to the text file
$files | ForEach-Object {
     $fullName = $_.FullName
    Write-Output $fullName
    $fullName | Out-File -Append -FilePath $outputFilePath
}

Write-Output "File names written to $outputFilePath"

Now you can call if in Azure pipeline using:

 #getting all files to sign in a file
    - task: PowerShell@2
      displayName: Get all files to sign
      inputs:
        arguments: filewithalltosign.txt
        filePath: 'nameoffilewithpreviouscode.ps1'

Now you can use filewithalltosign.txt as input of AzureSingTool -ifl filewithalltosign.txt

mcr222 avatar Feb 08 '24 11:02 mcr222