using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Security.Cryptography;

namespace DeCrypto
{
   class Program
   {
      static void Main(string[] args)
      {
         StreamReader sr = File.OpenText(@"..\..\..\..\JanesPrivateKey.xml");
         string janesKey = sr.ReadToEnd();
         sr.Close();

         RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
         rsa.FromXmlString(janesKey);

         FileStream fs = new FileStream(@"..\..\..\..\MessageToJane.dat", FileMode.Open);
         byte[] encrypted = new byte[fs.Length];
         fs.Read(encrypted, 0, (int)fs.Length);
         byte[] decrypted = rsa.Decrypt(encrypted, false);
         fs.Close();
         Console.WriteLine(System.Text.Encoding.GetEncoding(1250).GetString(decrypted));
         Console.ReadLine();
      }
   }
}
