I was able to solve this problem and create persistent certificates that can be used in EXE sessions by removing the default CertMaker.dll and BcMakeCert.dll , which FiddlerCore installs and uses and distributes makecert.exe executable makecert.exe .
makecert.exe appears to create certificates in such a way that they can be used for several application launches, where the included assemblies are valid only for the current application session.
Update:
If you want to use CertMaker.dll and BcMakeCert.dll , which FiddlerCore installs by default, you need to efficiently cache and install the certificate and private key using the Fiddlers internal settings object. There are several keys that contain the certificate after its creation, and you need to fix these values ββand write them to some configuration store.
In the following example, I have a static configuration object that contains a certificate and a key (stored in the configuration file when the application shuts down):
public static bool InstallCertificate() { if (!CertMaker.rootCertExists()) { if (!CertMaker.createRootCert()) return false; if (!CertMaker.trustRootCert()) return false; // persist Fiddlers certificate into app specific config App.Configuration.UrlCapture.Cert = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.cert", null); App.Configuration.UrlCapture.Key = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.bc.key", null); } return true; } public static bool UninstallCertificate() { if (CertMaker.rootCertExists()) { if (!CertMaker.removeFiddlerGeneratedCerts(true)) return false; } // persist Fiddlers certificate into app specific config App.Configuration.UrlCapture.Cert = null; App.Configuration.UrlCapture.Key = null; return true; }
After installing the certificate, this code captures the certificate and private key in the configuration object, which is saved in the future. To delete, the values ββare cleared.
At the beginning of the application or at the beginning of the capture process before calling CertMaker.rootCertExists() keys are set from the configuration values. I do this at the beginning of my capture form:
public FiddlerCapture() { InitializeComponent(); // read previously saved Fiddler certificate from app specific config if (!string.IsNullOrEmpty(App.Configuration.UrlCapture.Cert)) { FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.key", App.Configuration.UrlCapture.Key); FiddlerApplication.Prefs.SetStringPref("fiddler.certmaker.bc.cert", App.Configuration.UrlCapture.Cert); } }
Using this mechanism to save and configure capture parameters, certificates are stored in several EXE sessions when using CertMaker.dll.
More information is available in this detailed blog post on FiddlerCore .