blob: d3f750454f522b027be70b29a29bee45d580a28e [file] [log] [blame]
Steve Dower0cd63912018-12-10 18:52:57 -08001<#
2.Synopsis
3 Recursively signs the contents of a directory.
4.Description
5 Given the file patterns, code signs the contents.
6.Parameter root
7 The root directory to sign.
8.Parameter patterns
9 The file patterns to sign
10.Parameter description
11 The description to add to the signature (optional).
12.Parameter certname
13 The name of the certificate to sign with (optional).
14.Parameter certsha1
15 The SHA1 hash of the certificate to sign with (optional).
16#>
17param(
18 [Parameter(Mandatory=$true)][string]$root,
Steve Dower21a92f82019-06-14 08:29:20 -070019 [string[]]$patterns=@("*.exe", "*.dll", "*.pyd", "*.cat"),
Steve Dower0cd63912018-12-10 18:52:57 -080020 [string]$description,
21 [string]$certname,
22 [string]$certsha1,
23 [string]$certfile
24)
25
26$tools = $script:MyInvocation.MyCommand.Path | Split-Path -parent;
27Import-Module $tools\sdktools.psm1 -WarningAction SilentlyContinue -Force
28
29pushd $root
30try {
31 Sign-File -certname $certname -certsha1 $certsha1 -certfile $certfile -description $description -files (gci -r $patterns)
32} finally {
33 popd
34}