SHA256的密钥算法

17

下面的PowerShell命令创建一个使用SHA1签名算法的自签名证书。

New-SelfSignedCertificate -DnsName "MyCertificate", "www.contoso.com" -CertStoreLocation "cert:\LocalMachine\My" -Provider "Microsoft Strong Cryptographic Provider"

MyCertificate

我能通过传递任何值到这个命令中(例如:-KeyAlgorithm)来生成使用SHA256作为签名算法的证书吗?

1个回答

28

KeyAlgorithm参数定义了公钥算法,它与签名算法(您想要实现的内容)无关。相反,您需要使用-HashAlgorithm参数,并将SHA256指定为参数值:

New-SelfSignedCertificate -DnsName "MyCertificate", "www.contoso.com" `
    -CertStoreLocation "cert:\LocalMachine\My" `
    -Provider "Microsoft Strong Cryptographic Provider" `
    -HashAlgorithm "SHA256"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接