Search code examples
c#fiddlerclient-certificates

How to have multiple "ClientCertificate.cer" configured for Fiddler traffic requiring different certs


I am trying to use Fiddler to capture requests made by my application to external services. Some of these services require certificates installed on the local machine from which I am debugging. From some other documentation, i figured out that you need to store the certificate in %USERPROFILE%\Documents\Fiddler2 as "ClientCertificate.cer". Currently, for multiple certificates, I manually rename each certificate to "ClientCertificate.cer" to avoid any failures on Fiddler while capturing those requests.

Is it possible to configure all required certificates so that I dont have to manually rename them?


Solution

  • You can configure the client certificate based on the request data like URL when using FiddlerScript:

    static function OnBeforeRequest(oSession: Session) {
        if (oSession.HostnameIs("www.example.org") {
            oSession["https-Client-Certificate"] = "C:\\test\\someCert.cer";
        } else if (oSession.HostnameIs("www.example.com") {
            oSession["https-Client-Certificate"] = "C:\\test\\anotherCert.cer";
        }
    }
    

    https://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/RespondWithClientCert