Signing a PowerShell script with self-signed certificates (and without makecert.exe)

后端 未结 2 1373
一向
一向 2021-02-06 02:42

I\'m trying to sign a .ps1 using self-signed certificates (the use case is for scripts I write myself on my private dev station, so no need to use - or pay for - a

2条回答
  •  眼角桃花
    2021-02-06 02:57

    $cert = New-SelfSignedCertificate -CertStoreLocation Cert:\CurrentUser\My -Type CodeSigningCert -Subject "Code Signing"
    
    Move-Item -Path $cert.PSPath -Destination "Cert:\CurrentUser\Root"
    
    Set-AuthenticodeSignature -FilePath c:\go.ps1 -Certificate $cert
    

    source https://blogs.u2u.be/u2u/post/creating-a-self-signed-code-signing-certificate-from-powershell

提交回复
热议问题