SHARE
TWEET

Untitled

a guest Jun 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $certParams =
  2. @{
  3.   Type              = 'Custom'
  4.   KeyUsage          = 'DigitalSignature'
  5.   FriendlyName      = 'WindowsTerminal'
  6.   CertStoreLocation = 'Cert:\LocalMachine\My'
  7.   Subject           = (
  8.                         'CN=Microsoft Corporation',
  9.                         'O=Microsoft Corporation',
  10.                         'L=Redmond',
  11.                         'S=Washington',
  12.                         ' C=US'
  13.                       ) -join ','
  14.   TextExtension     = (
  15.                         '2.5.29.37={text}1.3.6.1.5.5.7.3.3',
  16.                         '2.5.29.19={text}'
  17.                       )
  18. }
  19.  
  20. $password = 'changeme'
  21.  
  22. $certExportParams =
  23. @{
  24.   FilePath = 'WindowsTerminal.pfx'
  25.   Password = ConvertTo-SecureString -String $password -Force -AsPlainText
  26.   Cert     = "Cert:\LocalMachine\My\$(
  27.                                        New-SelfSignedCertificate @certParams `
  28.                                        | Select-Object -ExpandProperty Thumbprint
  29.                                      )"
  30. }
  31. Export-PfxCertificate @certExportParams
  32.  
  33. Remove-Item -Path $certExportParams.Cert
  34.  
  35. $signTool    = Get-Item 'C:\Program Files (x86)\Windows Kits\10\bin\*\x86\SignTool.exe'
  36. $packageName = Get-Item CascadiaPackage_*_x64.msix `
  37.                | Select-Object -ExpandProperty Name
  38.  
  39. & $signTool sign /fd SHA256 `
  40.                  /a `
  41.                  /f $certExportParams.FilePath `
  42.                  /p $password `
  43.                  $packageName
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top