我需要创建一个自签名证书来测试使用mimekit.mimekit签名的电子邮件。它需要以下关键用法:
-
X509KeyUsageFlags.DigitalSignature
-
x509keyusageflags.nonrepudiation
根据文献记载
powershell
命令应该创建它:
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname tosign.mycompany.pt, mycompany.pt, mycompany.pt -KeyLength 4096
-keyUsage "DigitalSignature, NonRepudiation"
但它抛出:
New-SelfSignedCertificate : Cannot bind parameter 'KeyUsage'. Cannot convert value "DigitalSignature, NonRepudiation"