Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $certParams =
- @{
- Type = 'Custom'
- KeyUsage = 'DigitalSignature'
- FriendlyName = 'WindowsTerminal'
- CertStoreLocation = 'Cert:\LocalMachine\My'
- Subject = (
- 'CN=Microsoft Corporation',
- 'O=Microsoft Corporation',
- 'L=Redmond',
- 'S=Washington',
- ' C=US'
- ) -join ','
- TextExtension = (
- '2.5.29.37={text}1.3.6.1.5.5.7.3.3',
- '2.5.29.19={text}'
- )
- }
- $password = 'changeme'
- $certExportParams =
- @{
- FilePath = 'WindowsTerminal.pfx'
- Password = ConvertTo-SecureString -String $password -Force -AsPlainText
- Cert = "Cert:\LocalMachine\My\$(
- New-SelfSignedCertificate @certParams `
- | Select-Object -ExpandProperty Thumbprint
- )"
- }
- Export-PfxCertificate @certExportParams
- Remove-Item -Path $certExportParams.Cert
- $signTool = Get-Item 'C:\Program Files (x86)\Windows Kits\10\bin\*\x86\SignTool.exe'
- $packageName = Get-Item CascadiaPackage_*_x64.msix `
- | Select-Object -ExpandProperty Name
- & $signTool sign /fd SHA256 `
- /a `
- /f $certExportParams.FilePath `
- /p $password `
- $packageName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement