I created a selfsigned certifiacte with Power Shell cmdlet
New-SelfSignedCertificate -DnsName test.OJ.com -CertStoreLocation cert:\LocalMachine\My
After that the certificate can be seen in the certlm under personal\certificates
Now I want to use this certificate to sign a PS script. I tried two methods 1. with PS console
$cert = @(Get-ChildItem cert:\CurrentUser\My -CodeSigning)[0]
Set-AuthenticodeSignature .\scriptTosing.ps1 $cert
after the first command execution the $cert variable is empty
2. Using SingTool.exe
signtool.exe sign /debug /a ".\scriptTosing.ps1"
This is the result:
The following certificates were considered:
After EKU filter, 0 certs were left.
After expiry filter, 0 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.
Please advise