Reputation: 3964
The PowerShell command below creates a self-signed certificate with SHA1 as signature algorithm.
New-SelfSignedCertificate -DnsName "MyCertificate", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My" -Provider "Microsoft Strong Cryptographic Provider"
Is there any value that I can pass to this command (for example: -KeyAlgorithm
) to make the certificate generated using SHA256 as signature algorithm?
Upvotes: 17
Views: 11053
Reputation: 13954
KeyAlgorithm
parameter defines the public key algorithm which is not related to signature algorithm (what you are trying to accomplish). Instead, you need to use -HashAlgorithm
parameter and specify SHA256
as a parameter value:
New-SelfSignedCertificate -DnsName "MyCertificate", "www.contoso.com" `
-CertStoreLocation "cert:\LocalMachine\My" `
-Provider "Microsoft Strong Cryptographic Provider" `
-HashAlgorithm "SHA256"
Upvotes: 28