Example #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);
        }
Example #2
0
 public string GenerateCA(string name)
 {
     CAGen.GenerateCA(name);
     return("success");
 }