代码之家  ›  专栏  ›  技术社区  ›  dereli

在fiddlercore中使用自定义根目录

  •  6
  • dereli  · 技术社区  · 14 年前

    是否可以使用fiddlercore的自定义根CA来拦截HTTPS流量?

    我需要的是分配一个用于签署所有主机证书的证书。

    另一种解决方案是在创建根证书之前向fiddlercore提供证书信息。

    3 回复  |  直到 12 年前
        1
  •  1
  •   EricLaw    14 年前

    Fiddlercore目前不提供自定义其自签名根目录中包含的信息的功能。它将生成链接到名为do-not-trust-fiddleroot根的所有最终实体证书。

    你能详细说明为什么你寻求这种能力吗?

        2
  •  2
  •   josefresno    13 年前
    FiddlerApplication.Startup(9999, FiddlerCoreStartupFlags.DecryptSSL);
    var path = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location) + @"\sslcertificate.pfx";
    var secureEndpoint = FiddlerApplication.CreateProxyEndpoint(443, true, new X509Certificate2(path, "password"));
    

    您可以使用Visual Studio工具创建自己的证书,但是,我使用这个自由程序创建了一个测试一,因为我很懒惰: http://www.xenossoftware.com/freetools/certificategenerator/

    如果证书安装在机器上,我相信您也可以使用X509Store类执行相同的操作。

    下面是一些代码来执行此操作(未测试):

    FiddlerApplication.Startup(9999, FiddlerCoreStartupFlags.DecryptSSL);
    var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
    try
    {
    
        store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
    
        var x509Certificate2 = store.Certificates.Find(X509FindType.FindBySubjectName, "YourSSLCertificateName", true)[0];
    
        secureEndpoint = FiddlerApplication.CreateProxyEndpoint(443, true, x509Certificate2);
    
    }
    finally
    {
        store.Close();
    }
    
        3
  •  -1
  •   Francis    12 年前

    可以使用fiddleApplication的odeFaultclientCertificate属性指定现有证书。我在我的窗口服务应用程序上使用了这个,使用fiddlercorreapi来捕获HTTPS流量。

    var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    path = path.Replace("file:\\", "");
    if (!path.EndsWith(@"\")) path += @"\";
    path += "FiddlerRoot.cer";
    
    FiddlerApplication.AfterSessionComplete += FiddlerApplication_AfterSessionComplete;
    FiddlerApplication.oDefaultClientCertificate = new X509Certificate(path);
    FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.DecryptSSL);