]> apps.delaporte.us Git - dotfiles.git/blob - setup/codesign.ps1
Add usage examples.
[dotfiles.git] / setup / codesign.ps1
1 <#
2 .SYNPOSIS
3
4 Commands to maintain a local code singing cert.
5
6 #>
7 $certName = "Local Code Sign Cert"
8
9 function New-CodeSignCert {
10
11 $cert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "$certName"
12
13 }
14
15 function Get-CodeSignCert {
16 return Get-ChildItem -Path Cert:\CurrentUser\My | ? Subject -EQ "CN=$certName"
17 }
18
19 function Set-CodeSignCert {
20
21 $cert = Get-CodeSignCert
22 Move-Item -Path $cert.PSPath -Destination "Cert:\CurrentUser\Root"
23 }
24
25 function Invoke-SignScript {
26 param(
27 [string]$Path
28 )
29 $cert = Get-CodeSignCert
30 Set-AuthenticodeSignature -FilePath $Path -Certificate $cert
31 }
32
33
34 New-CodeSignCert
35 Set-CodeSignCert