using System.Security.Cryptography; namespace RsaKeyLoader; public class KeyLoader { public void Generate(string path) { var rsaKey = RSA.Create(); var privateKey = rsaKey.ExportRSAPrivateKey(); File.WriteAllBytes(path, privateKey); } }