protected virtual CertificateConfiguration LoadCertificateConfiguration(Certificates cert)
        {
            object findValue;
            X509FindType findType;

            var certConfig = new CertificateConfiguration
            {
                SubjectDistinguishedName = cert.SubjectDistinguishedName,
            };

            if (!string.IsNullOrWhiteSpace(cert.SubjectDistinguishedName))
            {
                findValue = cert.SubjectDistinguishedName;
                findType = X509FindType.FindBySubjectDistinguishedName;
            }
            else
            {
                Tracing.Error("No distinguished name or thumbprint for certificate: " + cert.Name);
                return certConfig;
            }

            try
            {
                var certFileName = cert.SubjectDistinguishedName.Split('|')[0];
                var certPassw0rd = cert.SubjectDistinguishedName.Split('|')[1];
                var signignCert = new X509Certificate2(
                                                        Path.Combine(AppDomain.CurrentDomain.BaseDirectory, certFileName),
                                                        certPassw0rd,
                                                        X509KeyStorageFlags.PersistKeySet);

                certConfig.Certificate = signignCert;
                //certConfig.Certificate = X509Certificates.GetCertificateFromStore(StoreLocation.LocalMachine, StoreName.My, findType, findValue);
            }
            catch
            {
                Tracing.Error("No certificate found for: " + findValue);
                throw new ConfigurationErrorsException("No certificate found for: " + findValue);
            }

            return certConfig;
        }
        protected virtual CertificateConfiguration LoadCertificateConfiguration(Certificates cert)
        {
            object findValue;
            X509FindType findType;

            var certConfig = new CertificateConfiguration
            {
                SubjectDistinguishedName = cert.SubjectDistinguishedName,
            };

            if (!string.IsNullOrWhiteSpace(cert.SubjectDistinguishedName))
            {
                findValue = cert.SubjectDistinguishedName;
                findType = X509FindType.FindBySubjectDistinguishedName;
            }
            else
            {
                Tracing.Error("No distinguished name or thumbprint for certificate: " + cert.Name);
                return certConfig;
            }

            try
            {
                certConfig.Certificate = X509Certificates.GetCertificateFromStore(StoreLocation.LocalMachine, StoreName.My, findType, findValue);
            }
            catch
            {
                Tracing.Error("No certificate found for: " + findValue);
                throw new ConfigurationErrorsException("No certificate found for: " + findValue);
            }

            return certConfig;
        }