You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/win_app_control/files/Set-ManifestSignature.ps1

27 lines
583 B
PowerShell

#!/usr/bin/env pwsh
# 0.5.0 fixed BOM-less encoding issues with Unicode
#Requires -Modules @{ ModuleName = 'OpenAuthenticode'; ModuleVersion = '0.5.0' }
using namespace System.Security.Cryptography.X509Certificates
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$Path,
[Parameter(Mandatory)]
[string]
$CertPath,
[Parameter(Mandatory)]
[string]
$CertPass
)
$ErrorActionPreference = 'Stop'
$cert = [X509Certificate2]::new($CertPath, $CertPass)
Set-OpenAuthenticodeSignature -FilePath $Path -Certificate $cert -HashAlgorithm SHA256