private X509Certificate2 FindDeveloperCertificateFile(ReplicaConfigurationReader configReader, ILogger <KestrelServer> logger)
        {
            string certificatePath = null;

            try
            {
                if (configReader.Certificates.TryGetValue("Development", out var certificateConfig) &&
                    certificateConfig.Path == null &&
                    certificateConfig.Password != null &&
                    TryGetCertificatePath(out certificatePath) &&
                    File.Exists(certificatePath))
                {
                    var certificate = new X509Certificate2(certificatePath, certificateConfig.Password);
                    return(IsDevelopmentCertificate(certificate) ? certificate : null);
                }
                else if (!File.Exists(certificatePath))
                {
                    logger.FailedToLocateDevelopmentCertificateFile(certificatePath);
                }
            }
            catch (CryptographicException)
            {
                logger.FailedToLoadDevelopmentCertificate(certificatePath);
            }

            return(null);
        }
 private void LoadDefaultCert(ReplicaConfigurationReader configReader)
 {
     if (configReader.Certificates.TryGetValue("Default", out var defaultCertConfig))
     {
         var defaultCert = LoadCertificate(defaultCertConfig, "Default");
         if (defaultCert != null)
         {
             //ZX
             //Options.DefaultCertificate = defaultCert;
         }
     }
     else
     {
         var logger      = Options.ApplicationServices.GetRequiredService <ILogger <KestrelServer> >();
         var certificate = FindDeveloperCertificateFile(configReader, logger);
         if (certificate != null)
         {
             logger.LocatedDevelopmentCertificate(certificate);
             //ZX
             //Options.DefaultCertificate = certificate;
         }
     }
 }
 internal ReplicaKestrelConfigurationLoader(KestrelServerOptions options, IConfiguration configuration)
 {
     Options             = options ?? throw new ArgumentNullException(nameof(options));
     Configuration       = configuration ?? throw new ArgumentNullException(nameof(configuration));
     ConfigurationReader = new ReplicaConfigurationReader(Configuration);
 }