forked from kine/NVRAppDevOps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSign-ALApp.ps1
37 lines (32 loc) · 1.22 KB
/
Sign-ALApp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<#
.SYNOPSIS
Sign the app file with certificate
.DESCRIPTION
Sign the app file with certificate using passed password
.EXAMPLE
Sign-ALApp -AppFile c:\AL\Myapp.app -CertPath https://mysite/mycert.cer -CertPwd Pass@word1
Sign the Myapp.app with certificate downloaded from the URL and using password Pass@word1
.Parameter AppFile
Path to the .app file to sign
.Parameter CertPath
Path/URL of the certificate
.Parameter CertPwd
Password for the certificate
#>
function Sign-ALApp
{
param(
[Parameter(ValueFromPipelineByPropertyName=$True)]
$AppFile,
[Parameter(ValueFromPipelineByPropertyName=$True)]
$CertPath,
[Parameter(ValueFromPipelineByPropertyName=$True)]
$CertPwd
)
if (Test-Path "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\SignTool.exe") {
$SignTool = (get-item "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\SignTool.exe").FullName
} else {
throw "Couldn't find SignTool.exe, please install Windows SDK from https://go.microsoft.com/fwlink/p/?LinkID=2023014"
}
& $SignTool sign /f $CertPath /p $CertPwd /t http://timestamp.verisign.com/scripts/timestamp.dll $AppFile
}