in code-explanation/keystore/C#/VisualStudio/keystore/Keystore.cs [13:35]
public void CreateKeyStore()
{
using var rsaServiceProvider = new RSACryptoServiceProvider();
try
{
var rsaParameters = rsaServiceProvider.ExportParameters(true);
var publicKey = rsaServiceProvider.ToXmlString(false);
var privateKey = rsaServiceProvider.ToXmlString(true);
WriteToXmlFile(PublicKeyFileName, publicKey);
WriteToXmlFile(PrivateKeyFileName, privateKey);
}
catch (CryptographicException exception)
{
Console.WriteLine($"An error occurred while creating the keystore: {exception.Message}");
}
}