如何在 IIS 中创建自签名 SAN 证书?

Den*_*ise 3 iis ssl ssl-certificate

是否可以在 IIS 中创建自签名 SAN ssl 证书?如果是这样,我该如何去创建它?在IIS中,我只看到创建普通ssl证书的选项:

在此处输入图片说明

Cry*_*t32 8

不幸的是,IIS 管理器无法创建带有 SAN 扩展名的证书或请求。你必须使用别的东西。例如,PowerShell 或 certreq.exe 工具(两者都包含在框中)。

电源外壳

最低要求参数

New-SelfsignedCertificate `
    -DnsName "mysite.com","www.mysite.com" `
    -CertStoreLocation cert:\localmachine\my
Run Code Online (Sandbox Code Playgroud)

更详细的参数

New-SelfsignedCertificate -Subject "CN=www.mysite.com" `
    -DnsName "mysite.com","www.mysite.com" `
    -EKU "Server Authentication" `
    -KeySpec "KeyExchange" ` 
    -KeyUsage "DigitalSignature", "KeyEncipherment" `
    -FriendlyName "My web site"
    -NotAfter $([datetime]::now.AddYears(1)) `
    -CertStoreLocation cert:\localmachine\my
Run Code Online (Sandbox Code Playgroud)

证书请求程序

准备具有以下内容的 INF 模板文件(具有 .inf 文件扩展名):

[NewRequest]
Subject = "CN=www.mysite.com"
KeyLength = 2048
KeyAlgorithm = RSA
ProviderName = "Microsoft Enhanced RSA and AES Cryptographic Provider"
MachineKeySet = true
KeySpec = 1
KeyUsage = 0xa0
RequestType = Cert
[EnhancedKeyUsageExtension]
OID=1.3.6.1.5.5.7.3.1 ; server authentication
[Extensions] 
2.5.29.17 = "{text}" 
_continue_ = "dns=mysite.com&" 
_continue_ = "dns=www.mysite.com"
Run Code Online (Sandbox Code Playgroud)

然后对这个 INF 文件执行以下命令:

certreq -new path\myinftemplate.inf
Run Code Online (Sandbox Code Playgroud)


Zor*_*che 2

什么版本的 Windows?如果是较新版本的 Windows,打开 powershell 并使用New-SelfSignedCertificate commandlet 可能会更容易。您可以使用 来-DnsName提供 SAN 中所需的所有名称的列表。