mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
31 lines
1.2 KiB
PowerShell
31 lines
1.2 KiB
PowerShell
param(
|
|
[string]
|
|
[Parameter(Mandatory=$true)]
|
|
# Folder path that contains the files you would like to sign. Recursive.
|
|
$PathToSignableFiles,
|
|
|
|
[string]
|
|
# The code signing certificate to use when signing the files.
|
|
$CertificatePath = "C:\mRemoteNG_code_signing_cert.pfx",
|
|
|
|
[SecureString]
|
|
# Password to unlock the code signing certificate.
|
|
$CertificatePassword = (Get-Credential -Message "Enter password for the mRemoteNG code signing certificate" -UserName "USERNAME NOT NEEDED").Password,
|
|
|
|
[string[]]
|
|
# File names to exclude from signing
|
|
$Exclude
|
|
)
|
|
|
|
|
|
$timeserver = "http://timestamp.verisign.com/scripts/timstamp.dll"
|
|
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertificatePath, $CertificatePassword)
|
|
|
|
|
|
Write-Output "Getting files from path: $PathToSignableFiles"
|
|
$signableFiles = Get-ChildItem -Path $PathToSignableFiles -Recurse | ?{$_.Extension -match "dll|exe|msi"} | ?{$Exclude -notcontains $_.Name}
|
|
Write-Output "Signable files count: $($signableFiles.Count)"
|
|
|
|
foreach ($file in $signableFiles) {
|
|
Set-AuthenticodeSignature -Certificate $cert -TimestampServer $timeserver -IncludeChain all -FilePath $file.FullName
|
|
} |