-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eng: Remove PFXs from codebase (#2219)
* Squashed commit of the following: commit a7d4033 Author: Tian Liao <tilia@microsoft.com> Date: Mon Aug 12 16:58:30 2024 +0800 remove pfx from ignore list commit 26ffa46 Author: Tian Liao <tilia@microsoft.com> Date: Mon Aug 12 16:58:07 2024 +0800 Remove PFXs * fix yaml * fix gh action * fix gh action
- Loading branch information
Showing
11 changed files
with
59 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#requires -RunAsAdministrator | ||
param( | ||
[Parameter(Position = 0, Mandatory = $true)][string]$AppToSign, | ||
[string]$SignTool = "C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe" | ||
) | ||
|
||
$AppToSign = (Resolve-Path -Path $AppToSign)[-1] | ||
Write-Host "AppToSign: $AppToSign" | ||
$SignTool = (Resolve-Path -Path $SignTool)[-1] | ||
Write-Host "SignTool: $SignTool" | ||
if ((Test-Path -Path $SignTool -PathType Leaf) -ne $true) { | ||
Write-Error "signtool is not found with the given argument: $SignTool" -ErrorAction Stop | ||
} | ||
|
||
$codeSignOid = New-Object -TypeName "System.Security.Cryptography.Oid" -ArgumentList @("1.3.6.1.5.5.7.3.3") | ||
$oidColl = New-Object -TypeName "System.Security.Cryptography.OidCollection" | ||
$oidColl.Add($codeSignOid) > $null | ||
$publisher = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" | ||
$certReq = New-Object -TypeName "System.Security.Cryptography.X509Certificates.CertificateRequest" ` | ||
-ArgumentList @($publisher, ([System.Security.Cryptography.ECDsa]::Create()), "SHA256") | ||
$certReq.CertificateExtensions.Add((New-Object -TypeName "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension" ` | ||
-ArgumentList @($oidColl, $false))) | ||
$now = Get-Date | ||
$cert = $certReq.CreateSelfSigned($now, $now.AddHours(1)) | ||
|
||
$pfxFile = "$($env:TEMP)\$(New-Guid).pfx" | ||
[System.IO.File]::WriteAllBytes($pfxFile, $cert.Export("Pfx")) | ||
Write-Host "Exported PFX: $pfxFile" | ||
|
||
& $SignTool sign /fd SHA256 /a /f $pfxFile $AppToSign | ||
Write-Host "Certificate Thumbprint: $($cert.Thumbprint.ToLower())" | ||
|
||
Import-PfxCertificate -CertStoreLocation 'Cert:\LocalMachine\TrustedPeople' -FilePath $pfxFile > $null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.