Windows 10 中缺少 makecert.exe,如何获取和使用它

Te7*_*e7a 4 c# iis configuration makecert windows-10

我使用的是 Windows 10。我没有 makecert.exe,当我尝试运行命令来生成证书时我才知道,就像 makecert.exe
我收到错误一样:

'makecert' 不是内部或外部命令,也不是可运行的程序或批处理文件。

我已经为 Windows 10 安装了 Windows SDK。

bee*_*r73 14

目前makecert已被弃用,使用 powershell ' New-SelfSignedCertificate '(作为管理员)的新方式,例如:

1.- We create a new root trusted cert:
$rootCert = New-SelfSignedCertificate -Subject 'CN=TestRootCA,O=TestRootCA,OU=TestRootCA' -KeyExportPolicy Exportable -KeyUsage CertSign,CRLSign,DigitalSignature -KeyLength 2048 -KeyUsageProperty All -KeyAlgorithm 'RSA' -HashAlgorithm 'SHA256'  -Provider 'Microsoft Enhanced RSA and AES Cryptographic Provider'

2.- We create the cert from the root trusted cert chain:
New-SelfSignedCertificate -DnsName "localhost" -FriendlyName "MyCert" -CertStoreLocation "cert:\LocalMachine\My" -Signer $rootCert -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1") -Provider "Microsoft Strong Cryptographic Provider" -HashAlgorithm "SHA256" -NotAfter (Get-Date).AddYears(10)

3.- We copy the thumbprint returned by the last command

4.- (If neccesary) We remove the last association ip/port/cert:
netsh http delete sslcert ipport=0.0.0.0:443

5.- We associate the new certificate with any ip and port 443 (the appid value does not matter, is any valid guid):
netsh http add sslcert ipport=0.0.0.0:443 appid='{214124cd-d05b-4309-9af9-9caa44b2b74a}' certhash=here_the_copied_thumbprint

6.- Now, you must open MMC (Certificates Local Computer) and drag and drop the 'TestRootCA' certificate from your 'Personal/Certificates' subfolder to 'Trusted Root Certification Authorities/Certificates' subfolder.
Run Code Online (Sandbox Code Playgroud)

这些命令还解决了 Google Chrome 稍后返回的错误ERR_CERT_WEAK_SIGNATURE_ALGORITHM,因为证书是使用 SHA1 而不是 SHA256 创建的


Dam*_*ver 11

它可能已安装,但可能只是不在路径中

例如,我可以在下找到它,C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64但我也可以在 下找到另一个C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86。路径中的确切版本将根据您安装的 SDK 的确切版本而有所不同。

PATH尽管这些路径都不在我的环境变量中(我不记得在安装 SDK 后明确删除它),所以我不能只makecert在命令行说,我必须提供我想要的完整路径跑步。


尝试查找副本位置的一种方便方法是where命令。在这里,我将搜索限制在 SDKs 目录中,但您可以根据需要搜索整个硬盘:

C:\Users\Damien>where /R "C:\Program Files (x86)\Windows Kits" makecert.*
C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\arm64\makecert.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x64\makecert.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86\makecert.exe
Run Code Online (Sandbox Code Playgroud)


Jes*_*aya 8

如果您安装了 Fiddler,Fiddler 也会附带 makecert.exe。它位于

C:\Users\<yourwindowslogin>\AppData\Local\Programs\Fiddler\makecert.exe 
Run Code Online (Sandbox Code Playgroud)


小智 5

这就是我安装 makecert.exe 文件的方式

(注意:我先安装了Windows 10 SDK,但是,这个版本没有在“bin”目录下安装makecert.exe。没问题!)

  1. https://www.microsoft.com/en-us/download/details.aspx?id=8279下载了 Windows SDK 7.1 ISO
  2. 我下载的ISO名称是GRMSDK_EN_DVD.iso
  3. 导航到下载目录并安装此 ISO(有软件可以轻松在 Windows 7/10 中安装)
  4. 安装后,导航到 ISO 中名为“Setup\WinSDKTools”的目录,您将在此目录中看到两个文件。一个是“WinSDKTools_x86.msi”,另一个是“cab1.cab”
  5. 将这两个文件复制到硬盘驱动器上的空目录中
  6. 从您的硬盘转到您复制这些文件的目录,然后右键单击“WinSDKTools_x86.msi”,然后选择“安装”
  7. 在您的硬盘驱动器上查找新创建的目录“C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1\Bin”
  8. Makecert.exe 现在应该与其他一些应用程序和文件夹一起位于这个新目录中
  9. 利润?