代码之家  ›  专栏  ›  技术社区  ›  MiguelSlv

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

  •  0
  • MiguelSlv  · 技术社区  · 6 年前

    我需要创建一个自签名证书来测试使用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"
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   srudin    6 年前
    New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname osign.mycompany.pt, mycompany.pt, mycompany.pt -KeyLength 4096 -keyUsage DigitalSignature,NonRepudiation