Exemplo n.º 1
0
        internal void EnsureDevelopmentCertificates()
        {
            var now         = DateTimeOffset.Now;
            var manager     = new CertificateManager();
            var certificate = manager.CreateAspNetCoreHttpsDevelopmentCertificate(now, now.AddYears(1), "CN=localhost");

            manager.ExportCertificate(certificate, path: _certificatePath, includePrivateKey: true, _certificatePassword);
        }
Exemplo n.º 2
0
    private static string EnsureDevelopmentCertificates(string certificatePath, string certificatePassword)
    {
        var now                   = DateTimeOffset.Now;
        var manager               = CertificateManager.Instance;
        var certificate           = manager.CreateAspNetCoreHttpsDevelopmentCertificate(now, now.AddYears(1));
        var certificateThumbprint = certificate.Thumbprint;

        CertificateManager.ExportCertificate(certificate, path: certificatePath, includePrivateKey: true, certificatePassword, CertificateKeyExportFormat.Pfx);

        return(certificateThumbprint);
    }