asked on
using System;
using System.Security.Cryptography;
using System.Text;
public class RSAProvider : AsymmetricBase
{
private RSACryptoServiceProvider _rsa;
private string _privatekey;
private string _publickey;
private int _keyid;
public RSAProvider()
{
Initialize();
this.GenerateKey();
}
public override void GenerateKey()
{
try
{
_rsa = new RSACryptoServiceProvider();
this._privatekey = _rsa.ToXmlString(true);
this._publickey = _rsa.ToXmlString(false);
this._keyid = -1;
}
catch (Exception e)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Error in GenerateKey() method.");
sb.AppendLine("Inner Message:");
sb.AppendLine(e.Message);
throw new ApplicationException(sb.ToString(), e);
}
}
}
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY