我将加密CLASSIFIED数据,我的数据必须使用最先进的加密保护.我使用AES加密数据,使用RSA加密密钥.我的RSA代码如下.请确认此代码是否安全:
static class Program
{
static void Main()
{
var csp = new RSACryptoServiceProvider(3072);
var privKey = csp.ExportParameters(true);
var pubKey = csp.ExportParameters(false);
string pubKeyString;
{
var sw = new System.IO.StringWriter();
var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
xs.Serialize(sw, pubKey);
pubKeyString = sw.ToString();
}
{
//get a stream from the string
var sr = new System.IO.StringReader(pubKeyString);
//we need a deserializer
var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
//get the object back from the stream
pubKey = (RSAParameters)xs.Deserialize(sr);
}
csp = new RSACryptoServiceProvider();
csp.ImportParameters(pubKey);
var plainTextData …Run Code Online (Sandbox Code Playgroud)