internal static NewCertificateProvider.ICertificateEngine CreateEngine(ICertificateProvider3 certificateProvider) { try { return(new NewCertificateProvider.CertEnrollEngine(certificateProvider)); } catch (Exception exception) { FiddlerApplication.Log.LogFormat("Failed to initialize CertEnrollEngine: {0}", new object[] { Utilities.GetExceptionInfo(exception) }); } return(null); }
public static bool StoreCert(string sHost, X509Certificate2 oCert) { CertMaker.EnsureReady(); ICertificateProvider3 certificateProvider = CertMaker.oCertProvider as ICertificateProvider3; if (certificateProvider == null) { return(false); } if (!oCert.HasPrivateKey) { throw new ArgumentException("The provided certificate MUST have a private key.", "oCert"); } return(certificateProvider.CacheCertificateForHost(sHost, oCert)); }
private CertEnrollEngine(ICertificateProvider3 ParentProvider) { this.icertificateProvider3_0 = ParentProvider; this.keyProviderName = FiddlerApplication.Prefs.GetStringPref("fiddler.certmaker.KeyProviderName", this.keyProviderName); this.type_0 = System.Type.GetTypeFromProgID("X509Enrollment.CX500DistinguishedName", true); this.type_1 = System.Type.GetTypeFromProgID("X509Enrollment.CX509PrivateKey", true); this.type_2 = System.Type.GetTypeFromProgID("X509Enrollment.CObjectId", true); this.type_3 = System.Type.GetTypeFromProgID("X509Enrollment.CObjectIds.1", true); this.type_5 = System.Type.GetTypeFromProgID("X509Enrollment.CX509ExtensionEnhancedKeyUsage"); this.type_4 = System.Type.GetTypeFromProgID("X509Enrollment.CX509ExtensionKeyUsage"); this.type_6 = System.Type.GetTypeFromProgID("X509Enrollment.CX509CertificateRequestCertificate"); this.type_7 = System.Type.GetTypeFromProgID("X509Enrollment.CX509Extensions"); this.type_8 = System.Type.GetTypeFromProgID("X509Enrollment.CX509ExtensionBasicConstraints"); this.type_9 = System.Type.GetTypeFromProgID("X509Enrollment.CSignerCertificate"); this.type_10 = System.Type.GetTypeFromProgID("X509Enrollment.CX509Enrollment"); this.type_11 = System.Type.GetTypeFromProgID("X509Enrollment.CAlternativeName"); this.type_12 = System.Type.GetTypeFromProgID("X509Enrollment.CAlternativeNames"); this.type_13 = System.Type.GetTypeFromProgID("X509Enrollment.CX509ExtensionAlternativeNames"); }