Beispiel #1
0
        public void DecryptFile(RsaAesEncryptor encryptor, string encryptedFile, string decryptedFile)
        {
            byte[] decryptedAesKey = _rsa.Decrypt(encryptor.AesEncryptedKey);
            byte[] decryptedAesIV  = _rsa.Decrypt(encryptor.AesEncryptedIV);

            AesEncryption aes = new AesEncryption(decryptedAesKey, decryptedAesIV);

            File.Delete(decryptedFile);
            aes.DecryptFile(encryptedFile, decryptedFile);
        }
Beispiel #2
0
        public void EncryptFile(RsaAesDecryptor decryptor, string file, string encryptedFile)
        {
            AesEncryption aes = new AesEncryption();
            RsaEncryption rsa = new RsaEncryption();

            _aesEncryptedKey = rsa.Encrypt(aes.Key, decryptor.PublicKey);
            _aesEncryptedIV  = rsa.Encrypt(aes.IV, decryptor.PublicKey);

            File.Delete(encryptedFile);
            aes.EncryptFile(file, encryptedFile);
        }