Using AES Crypt for CIL/.NET

This .NET AES Crypt package contains the C# class SharpAESCrypt.SharpAESCrypt, which provides file encryption and decryption using the AES Crypt file format.

Version 2 of the AES File Format is supported for reading and writing. Versions 0 and 1 are not verified, but there is code to read and write the formats.


The SharpAESCrypt package works with .NET 2.0+, and is tested with:

  • Windows, Microsoft.Net, 32bit and 64bit
  • Linux, various distrbutions, Mono 2.6+, 32bit (Mono limitation)
  • OSX 10.6+, Mono 2.6+, 32bit (Mono limitation)

Besides a CLI runtime, no further dependencies are required.

How to Use from the Command Line

Operation mode is selected with (e)ncrypt or (d)ecrypt.

Windows, Microsoft.Net

CLI Example

SharpAESCrypt e|d password fromPath toPath

Mono, Any platform

CLI Example

mono SharpAESCrypt e|d password fromPath toPath

Using as a library in a project

Simply add a reference to SharpAESCrypt.dll, and you can use the static methods like this:

API Examples

SharpAESCrypt.Encrypt("password", "inputfile", "outputfile");
SharpAESCrypt.Decrypt("password", "inputfile", "outputfile");
SharpAESCrypt.Decrypt("password", inputStream, outputStream);
SharpAESCrypt.Decrypt("password", inputStream, outputStream);

The syntax is for C# but the DLL works with any supported .NET language.

For more advanced uses, you can create a stream like this:

Source Code

Stream aesStream = new SharpAESCrypt(password, inputStream, mode);

You can set various properties on the stream. Remember to either call Dispose() or FlushFinalBlock() after using the stream.

See the documentation provided with the library for further details.