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

makecert.exe missing in windows 10, how to get it and use it

我正在使用 Windows 10。我没有 makecert.exe,这是我在尝试使用 运行 命令生成证书时才知道的,例如 makecert.exe
我收到错误:

'makecert' is not recognised as an internal or external command, operable program or batch file.

并且我已经为 windows 10.

安装了 windows SDK

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

例如,我可以在C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x64下找到它,但我也可以在C:\Program Files (x86)\Windows Kits\bin.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\bin.0.16299.0\arm64\makecert.exe
C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x64\makecert.exe
C:\Program Files (x86)\Windows Kits\bin.0.16299.0\x86\makecert.exe

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

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

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

我知道现在为时已晚,但我通过安装旧的 Windows 10 SDK 版本解决了这个问题:

我只是下载了这个文件并将其移动到 c:/winwdows/system32

https://onedrive.live.com/?authkey=%21AKVU0sMEK182FF0&id=26E0E257BE82A39E%2127335&cid=26E0E257BE82A39E

然后 运行 我在命令提示符下的命令如下:

Makecert -r -pe -n CN="MycomputerCertificate" -b 01/01/2020 -e 12/22/2030 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localmachine -sky exchange -sp "Microsoft RSA SChannel 加密提供程序" -sy 12

目前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  Personal/Certificates folder to Trusted Root Certification Authorities/Certificates.

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

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

C:\Users\<yourwindowslogin>\AppData\Local\Programs\Fiddler\makecert.exe