Encrypt or decrypt a file.

Namespace: LLCryptoLib.Crypto
Assembly: LLCryptoLib (in LLCryptoLib.dll) Version: 2.0.1024.0 (2.0.1024)

Syntax

C#
public void EncryptDecrypt(
	string inputFile,
	string outputFile,
	bool isCrypting,
	CallbackPoint cbp
)
Visual Basic
Public Sub EncryptDecrypt ( _
	inputFile As String, _
	outputFile As String, _
	isCrypting As Boolean, _
	cbp As CallbackPoint _
)
Visual C++
public:
void EncryptDecrypt(
	String^ inputFile, 
	String^ outputFile, 
	bool isCrypting, 
	CallbackPoint^ cbp
)

Parameters

inputFile
Type: System..::..String
File to read. If isCrypting, clear file else encrypted file.
outputFile
Type: System..::..String
File to write. if isCrypting, encrypted file.
isCrypting
Type: System..::..Boolean
True if encryption, false if decryption.
cbp
Type: LLCryptoLib..::..CallbackPoint
The feedback will be filled with 1 point each CACHE_SIZE wrote.

Examples

CopyC#
// 1. Set algorithm
IStreamAlgorithm cryptoAlgo = StreamAlgorithmFactory.Create(SupportedStreamAlgorithms.BLOWFISH);

// 2. Encrypt 
StreamCrypter crypter = new StreamCrypter(cryptoAlgo);
crypter.GenerateKeys("littlelitesoftware");
crypter.EncryptDecrypt(rndFile.FullName, encryptedFile, true, null);
Console.WriteLine("File encrypted into " + encryptedFile);

// 3. Decrypt
StreamCrypter decrypter = new StreamCrypter(cryptoAlgo);
crypter.GenerateKeys("littlelitesoftware");
crypter.EncryptDecrypt(encryptedFile, decryptedFile, false, null);
Console.WriteLine("File decrypted into " + decryptedFile);

Exceptions

ExceptionCondition
LLCryptoLib..::..LLCryptoLibException
System..::..ArgumentNullException

See Also