#region Disclaimer / License
// Copyright (C) 2015, The Duplicati Team
// http://www.duplicati.com, info@duplicati.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Duplicati.Library.Interface
{
///
/// Public interface for an encryption method.
/// All modules that implements encryption must implement this interface.
/// The classes that implements this interface MUST also
/// implement a default constructor and a constructor that
/// has the signature new(string passphrase, Dictionary<string, string> options).
/// The default constructor is used to construct an instance
/// so the DisplayName and other values can be read.
/// The other constructor is used to do the actual work.
/// An instance can be used to encrypt or decrypt multiple files/streams.
///
public interface IEncryption : IDisposable
{
///
/// Encrypts the contents of the inputfile, and saves the result as the outputfile.
///
/// The file to encrypt
/// The encrypted file
void Encrypt(string inputfile, string outputfile);
///
/// Encrypts the contents of the input stream, and writes the result to the output stream.
///
/// The stream to encrypt
/// The encrypted stream
void Encrypt(Stream input, Stream output);
///
/// Decrypts the contents of the input file and saves the result as the outputfile
///
/// The file to decrypt
/// The decrypted output file
void Decrypt(string inputfile, string outputfile);
///
/// Decrypts the contents of the input stream, and writes the result to the output stream.
///
/// The stream to decrypt
/// The decrypted stream
void Decrypt(Stream input, Stream output);
///
/// Decrypts the stream to the output stream
///
/// The encrypted stream
/// The unencrypted stream
Stream Decrypt(Stream input);
///
/// Encrypts the stream
///
/// The target stream
/// An encrypted stream that can be written to
Stream Encrypt(Stream input);
///
/// The extension that the encryption implementation adds to the filename
///
string FilenameExtension { get; }
///
/// A localized string describing the encryption module with a friendly name
///
string DisplayName { get; }
///
/// A localized description of the encryption module
///
string Description { get; }
///
/// Gets a list of supported commandline arguments
///
IList SupportedCommands { get; }
///
/// Returns the size in bytes of the overhead that will be added to a file of the given size when encrypted
///
/// The size of the file to encrypt
/// The size of the overhead in bytes
long SizeOverhead(long filesize);
}
}