Esempio n. 1
0
        public async Task EncryptFileAsync(string sourceFile, string destinationFile, SecureString passphrase)
        {
            if (sourceFile.IsNothing())
            {
                throw new ArgumentNullException(nameof(sourceFile));
            }
            if (destinationFile.IsNothing())
            {
                throw new ArgumentNullException(nameof(destinationFile));
            }
            if (passphrase == null)
            {
                throw new ArgumentNullException(nameof(passphrase));
            }

            if (!FileExists(sourceFile))
            {
                throw new FileNotFoundException(sourceFile);
            }

            await Confuzzle.EncryptFile(sourceFile).WithPassword(passphrase).IntoFile(destinationFile);
        }
Esempio n. 2
0
 public async Task SaveStringDataToEncryptedFileAsync(string fileName, string data, SecureString passphrase)
 {
     await Confuzzle.EncryptString(data).WithPassword(passphrase).IntoFile(fileName);
 }
Esempio n. 3
0
 public async Task <string> LoadEncryptedFileAsync(string fileName, SecureString passphrase)
 {
     return(await Confuzzle.DecryptFile(fileName).WithPassword(passphrase).IntoString());
 }