【问题标题】:makecert.exe missing in windows 10, how to get it and use itWindows 10 中缺少 makecert.exe,如何获取和使用它
【发布时间】:2018-07-19 08:56:02
【问题描述】:

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

'makecert' 未被识别为内部或外部命令, 可运行的程序或批处理文件。

我已经安装了适用于 windows 10 的 windows SDK。

【问题讨论】:

    标签: c# iis configuration windows-10 makecert


    【解决方案1】:

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

    例如,我可以在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
    

    【讨论】:

    • 首先感谢您的回答,但在此路径中我找不到makecert。 !!
    • @Te7a - 您是否拥有这些路径(或类似路径,考虑到版本差异)?如果有,它们是否包含任何东西?如果它们包含一些程序但不是专门的 makecert,我会重新运行 SDK 安装程序,看看您是否错过了一些包含 makecert 的可选组件。
    • “Windows 工具包”不是标准 Windows 10 安装的一部分。
    【解决方案2】:

    目前 ma​​kecert 已弃用,使用 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 创建的

    【讨论】:

    • 这很棒!谢谢你。你能举出 makecert.exe 被列为弃用的地方吗?
    • 注意 New-SelfSignedCertificate 需要 PowerShell v.4 或更高版本(相当于开箱即用的 Windows v8.1 / Windows Server 2012 R2 或更高版本)。
    • 太棒了,工作!
    【解决方案3】:

    这就是我安装 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. 利润?

    【讨论】:

    • 谢谢!这非常有效,除了我必须猜测我应该下载提供的三个 ISO 文件中的哪一个,“GRMSDK_EN_DVD.iso”、“GRMSDKIAI_EN_DVD.iso”或“GRMSDKX_EN_DVD.iso”(一点也不简单,为什么微软让你在这 3 个神秘命名的文件,好像您必须知道这些名称的含义?!)。我刚刚使用了第一个 ISO,而且毫无疑问,Makecert.exe 就在那里,太棒了!但是,为什么它只存在于 Windows 7 的 SDK 中?十多年前就没有更新过?!
    • Makecert.exe 从被弃用到不再包含在 SDK 中。新的解决方案是使用 PowerShell(如其他答案中所述)。如果需要,您必须获取 SDK 的旧副本。我相信它附带的最后一个是在10.0.18362.0 套件中。
    【解决方案4】:

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

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

    【讨论】:

      【解决方案5】:

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

      【讨论】:

        【解决方案6】:

        我只是下载这个文件并将它移动到 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 似乎可以作为独立的 exe 运行。
        猜你喜欢
        • 2011-07-27
        • 1970-01-01
        • 2021-11-04
        • 1970-01-01
        • 2016-04-08
        • 2015-10-24
        • 1970-01-01
        • 2019-09-18
        • 1970-01-01
        相关资源
        最近更新 更多