如何使用PowerShell 5创建具有2个关键用法的证书

问题描述 投票:0回答:1

我需要创建一个自签名证书来使用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"
powershell certificate self-signed
1个回答
0
投票
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname osign.mycompany.pt, mycompany.pt, mycompany.pt -KeyLength 4096 -keyUsage DigitalSignature,NonRepudiation
© www.soinside.com 2019 - 2024. All rights reserved.