繁体   English   中英

如何使用Powershell 5创建具有2个密钥用法的证书

[英]How to create an certificate with 2 key usages using powershell 5

我需要创建一个自签名证书来使用MimeKit.MimeKit测试签名的电子邮件。 它需要以下KeyUsages:

  • 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"
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname osign.mycompany.pt, mycompany.pt, mycompany.pt -KeyLength 4096 -keyUsage DigitalSignature,NonRepudiation

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM