Ejemplo n.º 1
0
        public FileConstructor(CryptoAgent cryptoAgent)
        {
            //FileStream fileStream = new FileStream(cryptoAgent.Path, FileMode.Open);
            File.SetAttributes(cryptoAgent.Path, FileAttributes.Hidden);

            FileStream encrFile = new FileStream(cryptoAgent.Path + "/" + cryptoAgent.Name + "-encr" + cryptoAgent.Extension, FileMode.OpenOrCreate);

            encrFile.Write(cryptoAgent.encrypted, 0, cryptoAgent.EncrSize);
            encrFile.Close();
            FileStream decrFile = new FileStream(cryptoAgent.Name + "-decr" + cryptoAgent.Extension, FileMode.OpenOrCreate);

            decrFile.Write(cryptoAgent.decrypted, 0, cryptoAgent.DecrSize);
            decrFile.Close();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("Write full path to file");
            string path = Console.ReadLine();

            Console.WriteLine("Full path is:" + path);

            //RijndaelManaged myRijndael = CryptoAgent.GenerateKeys();

            //CryptoAgent cryptoAgent = new CryptoAgent(path, myRijndael.Key, myRijndael.IV);
            //FileConstructor fileConstructor = new FileConstructor(cryptoAgent);

            CryptoAgent cryptoAgent = new CryptoAgent(path, "password");
        }