简体   繁体   English

如何在商店中找到我需要的证书?

[英]How to find in store the certificate I need?

For one of my applications I am developing against the TeleCashAPI (Internet Payment Gateway). 对于我的一个应用程序,我正在针对TeleCashAPI(Internet支付网关)进行开发。 I need to send a client certificate (p12) on each call. 我需要在每次通话中发送客户证书(p12)。

Until now I have loaded the Client Certificate via Filesystem 到目前为止,我已经通过文件系统加载了客户端证书

public void AddCertificate(X509Certificate certificate)
{
    WebRequest.ClientCertificates.Add(certificate);
}

Now my customer want to have it more generic. 现在,我的客户希望使它更通用。 It should be installed on the client machine (which is talking to this api). 它应该安装在客户端计算机上(正在与该API通讯)。 I still know what is the password, but I don't know the certificate. 我仍然知道密码是什么,但是我不知道证书。

How can I get the Certificate? 我如何获得证书?

From this answer , I see how I can get the whole list: 从这个答案中 ,我看到了如何获得整个列表:

X509Store store = new X509Store("My");

store.Open(OpenFlags.ReadOnly);

foreach (X509Certificate2 mCert in store.Certificates){
    //TODO's
}

But how I find the certificate I specificly want to have? 但是我如何找到我特别想要的证书? Is this even posssible? 这甚至可能吗?

I am realy new to this topic. 我真的很陌生。


To be a little bit more clear: 更清楚一点:

The certificate is installed by doubleclick. 通过双击安装证书。 I can not controll this process. 我无法控制这个过程。 My Task is, to find the certificate, which is for TeleCash. 我的任务是找到用于TeleCash的证书。

To know certificate hash - double click on certificate -> details -> Thumbprint 要知道证书哈希-双击证书->详细信息->指纹

foreach (X509Certificate2 mCert in store.Certificates)
{
    if(mCert.Thumbprint.ToLower()=="Your Certificat hash")
    {
        //TODO
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM