using System;
using System.IO;
using System.Security.Cryptography;
class MainClass
{
public static void Main()
{
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
Byte[] testData = {1, 2, 3, 4, 5, 6, 7, 8};
Byte[] encryptedData = rsa.Encrypt(testData, false);
Console.WriteLine("Encrypted data:");
for(int i=0; i<encryptedData.GetLength(0); i++)
{
Console.Write("{0} ", encryptedData[i]);
}
Byte[] decryptedData = rsa.Decrypt(encryptedData, false);
Console.WriteLine("Decrypted Data:");
for(int i=0; i<decryptedData.GetLength(0); i++)
{
Console.Write("{0} ", decryptedData[i]);
}
}
}
|