【问题标题】:Windows Machine Cert File MappingsWindows 机器证书文件映射
【发布时间】:2018-05-31 01:11:25
【问题描述】:

BLUF

如果知道windows机器证书文件名,可以查看windows证书存储中的文件内容吗?

背景

我正在使用 Windows 7+ VPN 客户端。它不允许您直接选择应用于连接的证书,并且提供的反馈非常有限。最臭名昭著的错误 RRAC 是 13801,大致总结为“我不喜欢正在使用的证书,但我不会告诉你具体是什么”。

使用事件查看器查看安全条目,我确实看到有证书请求。比如:

 ProviderName Microsoft Software Key Storage Provider 
  AlgorithmName UNKNOWN 
  KeyName {#################} 
  KeyType %%2499 
  KeyFilePath C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\<filename>
  Operation %%2458 
  ReturnCode 0x0 

我想知道如何使用上面提到的文件名来查看证书属性(IE:看到正在使用我想要的文件名)。现在我唯一的方法是通过 mmc 导入证书并在导入时查看正在创建的新文件。我不能对系统上已经导入的证书使用这个技巧。

【问题讨论】:

    标签: windows cryptography vpn


    【解决方案1】:

    这里的所有标识符都用于私钥。私钥不知道证书的位置,因为架构是证书对象/证书存储知道给定证书的私钥在哪里。

    要查看证书存储中的证书与系统上的密钥之间的映射,您可以使用certutil -store,例如:

    C:\>certutil -store my
    my
    ================ Certificate 0 ================
    ...
    ================ Certificate 7 ================
    Serial Number: 3451b93c10f9279348a949f729d1ff10
    Issuer: CN=localhost
     NotBefore: 1/26/2015 2:19 PM
     NotAfter: 1/25/2020 4:00 PM
    Subject: CN=localhost
    Signature matches Public Key
    Root Certificate: Subject matches Issuer
    Template:
    Cert Hash(sha1): 15 e3 4c d3 2d a7 54 99 a9 17 8f 17 26 25 63 25 8f 3a 94 28
      Key Container = IIS Express Development Certificate Container
      Unique container name: fad662b360941f26a1193357aab3c12d_1fcb2e07-cec4-4ba1-9c78-58a431e1aefd
      Provider = Microsoft RSA SChannel Cryptographic Provider
    Encryption test passed
    CertUtil: -store command completed successfully.
    

    在此输出中要匹配的东西是 Key Container 与事件中的 KeyContainerName 相同,并且此输出中的 Provider 在事件中是 ProviderName

    你也可以dump用户存储(默认是机器):

    C:\>certutil -user -store -silent my
    my
    ================ Certificate 0 ================
    Serial Number: 0123456789abcdef
    Issuer: E=issueremail@example.org, CN=cn.issuer.example.org, OU=ExampleOU, O=ExampleO, L=Locality, S=State, C=Country
     NotBefore: 11/12/2013 6:15 AM
     NotAfter: 12/13/2014 7:16 AM
    Subject: E=subjectemail@example.org, CN=cn.subject.example.org, OU=ExampleOU, O=ExampleO, L=Locality, S=State, C=Country
    Non-root Certificate
    Template:
    Cert Hash(sha1): ff 3d 35 54 54 fd ff ea 52 cd 71 6f e7 14 24 75 3f f7 fe cf
      Key Container = {F76693EF-BDC3-4AEC-855A-3A2F65EB9C14}
      Unique container name: 0148994a057f4e05acb6407550cdde40_1fcb2e07-cec4-4ba1-9c78-58a431e1aefd
      Provider = Microsoft Enhanced RSA and AES Cryptographic Provider
    Private key is NOT exportable
    Encryption test passed
    
    ...
    ================ Certificate 51 ================
    Serial Number: 0123456789abcdef
    Issuer: E=issueremail@example.org, CN=cn.issuer.example.org, OU=ExampleOU, O=ExampleO, L=Locality, S=State, C=Country
     NotBefore: 11/12/2013 6:15 AM
     NotAfter: 12/13/2014 7:16 AM
    Subject: E=subjectemail@example.org, L=Locality, S=State, C=Country
    Non-root Certificate
    Template:
    Cert Hash(sha1): 2a 81 f8 d1 c7 40 13 2f 15 5a 5e 30 41 1a 2b 13 71 93 db 9e
      Key Container = {2572D484-D352-4B32-BB00-236B755B7F81}
      Unique container name: b11d717c1718a3bc6ad1769f2226998e_1fcb2e07-cec4-4ba1-9c78-58a431e1aefd
      Provider = Microsoft Enhanced RSA and AES Cryptographic Provider
    Private key is NOT exportable
    Encryption test passed
    

    除了-user 开关之外,我还指定了-silent,因为我有一些智能卡支持的证书,我不想处理提示输入卡和 PIN 的问题。

    【讨论】:

    • 是的,它提供了我需要的映射。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    • 2012-03-06
    • 2022-12-14
    • 1970-01-01
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    相关资源
    最近更新 更多