public SignPrivateCertificateResult SignCertificate(SignPrivateCertificateModel model, ClaimsPrincipal user) { CertificateRequest csr = certificateProvider.InitializeFromEncodedCsr(model.EncodedCsr); AdcsTemplate template = templateLogic.DiscoverTemplate(csr.CipherAlgorithm, WindowsApi.Cng, KeyUsage.ServerAuthentication); if (authorizationLogic.IsAuthorized(template, user)) { MicrosoftCertificateAuthority ca = configurationRepository.GetPrivateCertificateAuthority(model.HashAlgorithm); CertificateAuthorityRequestResponse response = ca.Sign(csr, template.Name, template.KeyUsage); return(HandleCertificateAuthorityResponse(model, response, csr.Subject)); } else { return(ProcessPendingSigningWorkflow(model)); } }