Powershell New-SelfSignedCertificate CA 无法在 iOS 14.2 上运行
Powershell New-SelfSignedCertificate CA not working on iOS 14.2
我正在尝试使用 Powershell 为 IIS 应用程序生成 CA 和 SSL 证书。当我手动将 CA 添加到本地计算机证书根存储时,它在 Windows 上按预期工作。
问题是从 smartphone 连接,当我尝试安装它时 iPhone 拒绝识别 CA。
这是 CA 脚本:
$ca_certificate = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -NotAfter (Get-Date).AddDays(820) -DnsName 'VMS Certificate Authority' -KeyusageProperty All `
-KeyUsage CertSign, CRLSign, DigitalSignature -FriendlyName 'My CA' -KeyAlgorithm RSA -KeyLength 2048
Export-Certificate -Cert "Cert:\CurrentUser\My$($ca_certificate.Thumbprint)" -FilePath "$PSScriptRoot\root-authority-public.cer"
我可以在我的 iPhone 上安装配置文件,但在安装过程中我收到警告消息“无法验证“我的 CA”的真实性”,除此之外什么都没有。安装后状态仍然是“未验证”。 General->About->Certificate Trust Settings下什么都没有(只信任store/asset版本)
我设法创建了一个 openssl CA,它已成功添加到 phone,但未被使用 SSL 证书的应用程序识别。
有人有这方面的经验吗?
我设法让它工作了。显然 iOS 不会将证书识别为 CA,除非它具有基本约束 Subject Type=CA。
-TextExtension @("2.5.29.19={text}cA=true&pathLength=2")
因此,有效期为 5 年的 CA 的完整命令可能是
$ca_certificate = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -DnsName 'My Awesome CA' -KeyusageProperty All `
-KeyUsage CertSign, CRLSign, DigitalSignature -FriendlyName 'My Awesome CA' -TextExtension @("2.5.29.19={text}cA=true&pathLength=2") -NotAfter (Get-Date).AddYears(5)
重要提示:
创建证书后,您必须将其导出为 CERTIFICATE 而不是 PFX 证书。 PFX 证书包含密钥,需要用密码保护。我不确定这是否是 iOS 15 的变化,但它可能是。
我尝试了十几种不同的 New-SelfSignedCertificate
命令组合,但结果是我导出证书时使用了:
Export-PfxCertificate -cert cert:\localMachine\myC730102B3E... -FilePath 1.pfx
我一切换到这个命令,它就起作用了:
Export-Certificate -cert cert:\localMachine\myC730102B3E... -FilePath 2.pfx
是的,我故意使用 .pfx
作为扩展名。您可以使用 .cer
,但我通过在 Safari 中访问它来安装它,因为 URL 和 .cer
似乎不起作用。关键是该文件不包含完整的证书。
当您安装它时,如果您没有收到以下警告信号的消息,它就不会工作:
Installing the certificate "XXXXX" will add it to the list of trusted certificates on your iPhone. This certificate will not be trusted for websites until you enable it in Certificate Trust Settings.
然后您当然需要去 General->About->Certificate Trust Settings
启用它 - 它现在应该显示在那里。
我正在尝试使用 Powershell 为 IIS 应用程序生成 CA 和 SSL 证书。当我手动将 CA 添加到本地计算机证书根存储时,它在 Windows 上按预期工作。
问题是从 smartphone 连接,当我尝试安装它时 iPhone 拒绝识别 CA。
这是 CA 脚本:
$ca_certificate = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -NotAfter (Get-Date).AddDays(820) -DnsName 'VMS Certificate Authority' -KeyusageProperty All `
-KeyUsage CertSign, CRLSign, DigitalSignature -FriendlyName 'My CA' -KeyAlgorithm RSA -KeyLength 2048
Export-Certificate -Cert "Cert:\CurrentUser\My$($ca_certificate.Thumbprint)" -FilePath "$PSScriptRoot\root-authority-public.cer"
我可以在我的 iPhone 上安装配置文件,但在安装过程中我收到警告消息“无法验证“我的 CA”的真实性”,除此之外什么都没有。安装后状态仍然是“未验证”。 General->About->Certificate Trust Settings下什么都没有(只信任store/asset版本)
我设法创建了一个 openssl CA,它已成功添加到 phone,但未被使用 SSL 证书的应用程序识别。
有人有这方面的经验吗?
我设法让它工作了。显然 iOS 不会将证书识别为 CA,除非它具有基本约束 Subject Type=CA。
-TextExtension @("2.5.29.19={text}cA=true&pathLength=2")
因此,有效期为 5 年的 CA 的完整命令可能是
$ca_certificate = New-SelfSignedCertificate -CertStoreLocation cert:\CurrentUser\My -DnsName 'My Awesome CA' -KeyusageProperty All `
-KeyUsage CertSign, CRLSign, DigitalSignature -FriendlyName 'My Awesome CA' -TextExtension @("2.5.29.19={text}cA=true&pathLength=2") -NotAfter (Get-Date).AddYears(5)
重要提示:
创建证书后,您必须将其导出为 CERTIFICATE 而不是 PFX 证书。 PFX 证书包含密钥,需要用密码保护。我不确定这是否是 iOS 15 的变化,但它可能是。
我尝试了十几种不同的 New-SelfSignedCertificate
命令组合,但结果是我导出证书时使用了:
Export-PfxCertificate -cert cert:\localMachine\myC730102B3E... -FilePath 1.pfx
我一切换到这个命令,它就起作用了:
Export-Certificate -cert cert:\localMachine\myC730102B3E... -FilePath 2.pfx
是的,我故意使用 .pfx
作为扩展名。您可以使用 .cer
,但我通过在 Safari 中访问它来安装它,因为 URL 和 .cer
似乎不起作用。关键是该文件不包含完整的证书。
当您安装它时,如果您没有收到以下警告信号的消息,它就不会工作:
Installing the certificate "XXXXX" will add it to the list of trusted certificates on your iPhone. This certificate will not be trusted for websites until you enable it in Certificate Trust Settings.
然后您当然需要去 General->About->Certificate Trust Settings
启用它 - 它现在应该显示在那里。