public HomeController(IConfiguration configuration, FileNameHelper fileNameHelper, CoreEncryption coreEncryption, HttpClient httpClient)
 {
     this.configuration  = configuration;
     this.fileNameHelper = fileNameHelper;
     this.coreEncryption = coreEncryption;
     this.httpClient     = httpClient;
 }
Пример #2
0
            public void EncryptFile(string file, string password)
            {
                byte[] bytesToBeEncrypted = File.ReadAllBytes(file);
                byte[] passwordBytes      = Encoding.UTF8.GetBytes(password);

                passwordBytes = SHA256.Create().ComputeHash(passwordBytes);

                byte[] bytesEncrypted = CoreEncryption.AES_Encrypt(bytesToBeEncrypted, passwordBytes);

                string fileEncrypted = file;

                File.WriteAllBytes(fileEncrypted, bytesEncrypted);
            }