Exemplo n.º 1
0
        Dictionary <string, CertificateHolder> LoadCertificates(string path)
        {
            var ret = new Dictionary <string, CertificateHolder>();

            if (!Directory.Exists(path))
            {
                return(ret);
            }

            foreach (var file in new DirectoryInfo(path).GetFiles("*.p12"))
            {
                var nameNoExt = Path.GetFileNameWithoutExtension(file.Name);
                var idx       = nameNoExt.IndexOf('_');
                var name      = idx != -1 ? nameNoExt.Substring(0, idx) : nameNoExt;
                var host      = idx != -1 ? nameNoExt.Substring(idx + 1) : nameNoExt;
                ret[name] = new CertificateHolder(host, File.ReadAllBytes(file.FullName));
            }

            return(ret);
        }
Exemplo n.º 2
0
        Dictionary<string, CertificateHolder> LoadCertificates(string path)
        {
            var ret = new Dictionary<string, CertificateHolder>();
            if (!Directory.Exists(path))
                return ret;

            foreach (var file in new DirectoryInfo(path).GetFiles("*.p12"))
            {
                var nameNoExt = Path.GetFileNameWithoutExtension(file.Name);
                var idx = nameNoExt.IndexOf('_');
                var name = idx != -1 ? nameNoExt.Substring(0, idx) : nameNoExt;
                var host = idx != -1 ? nameNoExt.Substring(idx + 1) : nameNoExt;
                ret[name] = new CertificateHolder(host, File.ReadAllBytes(file.FullName));
            }

            return ret;
        }