public IActionResult DownloadRootCertificate([FromServices] RootAuthorityAppService rootAuthorityAppService)
        {
            string formatedCertString = rootAuthorityAppService.GetRootCertificate();

            Response.Headers.Add("Content-Disposition", $"attachment;filename=agilelabs_root_ca.pem");
            return(File(Encoding.UTF8.GetBytes(formatedCertString), "application/x-x509-ca-cert"));
        }
        public async Task <IActionResult> DownnloadCertificatePemFormat(Guid certSysid,
                                                                        [FromServices] SystemContext adminDbContext,
                                                                        [FromServices] RootAuthorityAppService rootAuthorityAppService,
                                                                        [FromServices] DeviceCertificateAppService deviceCertificateAppService)
        {
            var deviceCertString     = deviceCertificateAppService.GetDeviceCertificate(certSysid);
            var deviceRootCertString = rootAuthorityAppService.GetRootCertificate();

            var pemFormatCertContent = $"{deviceCertString}{Environment.NewLine}{deviceRootCertString}";

            Response.Headers.Add("Content-Disposition", $"attachment;filename={certSysid}.pem");
            //content type get from: https://www.thoughtco.com/mime-types-by-content-type-3469108
            await Task.CompletedTask;

            return(File(Encoding.UTF8.GetBytes(pemFormatCertContent), "application/x-pem-file"));
        }