I am new to FiddlerCore and after trial and error I was able to get most of my code working as intended. The main issue I am now having is creating and trusting a custom root certificate. If I read the documentation correctly, in order for us to not have to install a temporary certificate each time the program is ran, we need to create, read, and trust our own custom certificate. I have placed the FiddlerCore document scripts in my program but it is not recognizing the read/write rootcertificateandandprivatekeyto pkcs12file, attached below is my code:
private void createcert()
{
BCCertMaker.BCCertMaker certProvider = new BCCertMaker.BCCertMaker();
CertMaker.oCertProvider = certProvider;
if (!CertMaker.rootCertExists())
{
string rootCertificatePath = @"Path\To\Your\Root\Certificate\RootCertificate.p12";
string rootCertificatePassword = "S0m3T0pS3cr3tP4ssw0rd";
if (!File.Exists(rootCertificatePath))
{
certProvider.CreateRootCertificate();
certProvider.WriteRootCertificateAndPrivateKeyToPkcs12File(rootCertificatePath, rootCertificatePassword);
}
/* if (!CertMaker.rootCertExists())
{
CertMaker.createRootCert();
CertMaker.trustRootCert();
}*/
}
}
private void readcert()
{
BCCertMaker.BCCertMaker certProvider = new BCCertMaker.BCCertMaker();
CertMaker.oCertProvider = certProvider;
string rootCertificatePath = @"Path\To\Your\Root\Certificate\RootCertificate.p12";
string rootCertificatePassword = "S0m3T0pS3cr3tP4ssw0rd";
if (File.Exists(rootCertificatePath))
{
certProvider.ReadRootCertificateAndPrivateKeyFromPkcs12File(rootCertificatePath, rootCertificatePassword);
}
}
private void installcert()
{
if (!CertMaker.rootCertIsTrusted())
{
CertMaker.trustRootCert();
}
}
The Error code is this:
Severity Code Description Project File Line Suppression State Error CS1061 'BCCertMaker' does not contain a definition for 'WriteRootCertificateAndPrivateKeyToPkcs12File' and no accessible extension method 'WriteRootCertificateAndPrivateKeyToPkcs12File' accepting a first argument of type 'BCCertMaker' could be found (are you missing a using directive or an assembly reference?) FiddlerCore tuto 1 C:\Users\SHADOWGHOSTS\Desktop\FiddlerCore-Tuto-main\FiddlerCore tuto 1\Form1.cs 147 Active
and the documentation I was following is here: https://docs.telerik.com/fiddlercore/basic-usage/use-custom-root-certificate
I added this code and it is giving me an error as shown above.
I'm experiencing a similar issue. I suspect the problem may be related to using an outdated version of the FiddlerCore library. To address this, you can implement the ICertificateProvider interface and create a custom GetRootCertificate method. This should help resolve the issue.
Then you can utilize your provider.