Skip to content

Instantly share code, notes, and snippets.

@MayMeow
Last active February 13, 2022 03:07
Show Gist options
  • Save MayMeow/c5864f73df3d6f1ad5bd4ea91c496d9e to your computer and use it in GitHub Desktop.
Save MayMeow/c5864f73df3d6f1ad5bd4ea91c496d9e to your computer and use it in GitHub Desktop.
Selfsigned Certificates for Code signing in visual studio

Create CA file

$c = New-SelfSignedCertificate -DnsName SelfSignedCA -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(10)

check certificate fingerprint

$c

  PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\My

Thumbprint                                Subject
----------                                -------
07AA8E037F6D1D83CA1B5023318981DDFB546BFB  CN=SelfSignedCA

Sign Certificate for code signing

New-SelfSignedCertificate -Type CodeSigningCert -Subject "May Meow" -CertStoreLocation "Cert:\CurrentUser\My" -KeySpec 2 -Signer $c

# or later
# use full path to your certificate
New-SelfSignedCertificate -Type CodeSigningCert -Subject "May Meow" -CertStoreLocation "Cert:\CurrentUser\My" -KeySpec 2 -Signer Cert:\CurrentUser\My\07AA8E037F6D1D83CA1B5023318981DDFB546BFB -HashAlgorithm "sha1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment