Example #1
0
        private static void GenerateX509Certificate(string password, string filename)
        {
            Log.Information("Generating X509 certificate...");
            filename = Path.Combine(AppContext.BaseDirectory, filename);

            var cert = X509.Generate(subject: AppName, password, X509KeyStorageFlags.Exportable);

            IOFile.WriteAllBytes(filename, cert.Export(X509ContentType.Pkcs12, password));

            Log.Information($"Password: {password}");
            Log.Information($"Certificate exported to {filename}");
        }