开发者

Using custom root with FiddlerCore

Is it possible to use a custom root CA for FiddlerCore to intercept HTTPS traffic.

What I need is assigning a certificate to be used to to sign all开发者_C百科 host certificates.

Another solution can be supplying certificate information to FiddlerCore before creating root certificate.


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

You can create your own certificate using Visual Studio tools, however, I used this free program to create a test one cause I am lazy: http://www.xenossoftware.com/freetools/certificategenerator/

If the certificate is installed on the machine, I believe you can also do the same thing using the X509Store class.

Here is some code to do this (not tested):

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();
}


FiddlerCore does not currently offer the ability to customize the information contained in its self-signed root. It will generate all end-entity certificates chained to the root named DO_NOT_TRUST_FiddlerRoot.

Can you elaborate on why you seek this capability?


You can use oDefaultClientCertificate property of FiddlerApplication to specify existing certificate. I used this on my window service application using FiddlerCoreAPI to capture HTTPS traffic.

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜