Exemplo n.º 1
0
        public string GenerateCA(string hosts)
        {
            var caName                = RandomHelper.NextString(10, false);
            X509Certificate2 ca       = CAGen.GenerateCA(caName, hosts);
            var           export      = ca.Export(X509ContentType.Pfx);
            string        baseLogPath = "./temp";
            string        fileName    = "_" + caName + ".pfx";
            string        targetPath  = baseLogPath + "/" + fileName;
            DirectoryInfo dir         = new DirectoryInfo(baseLogPath);

            if (!dir.Exists)
            {
                dir.Create();
            }

            // File.Move(fileInfo.FullName, baseLogPath + "/" + port + ".pfx");
            File.WriteAllBytes(targetPath, export);
            return(fileName);
        }
Exemplo n.º 2
0
 public string GenerateCA(string name)
 {
     CAGen.GenerateCA(name);
     return("success");
 }