Skip to content
Simple library to do Authenticated Encryption in an opinionated way
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
AuthenticatedEncryption.Tests Updated project file Mar 13, 2017
AuthenticatedEncryption Upgrade to VS 2017 Mar 10, 2017
.gitignore Updated gitignore Mar 13, 2017
AuthenticatedEncryption.sln Upgrade to VS 2017 Mar 10, 2017
LICENSE Initial commit Dec 16, 2016 Updated readme with an installation section Mar 13, 2017
appveyor.yml Updated path to test project file Mar 13, 2017

Authenticated Encryption

This library combines the .NET built-in AES and HMAC algorithms to provide an easy-to-use interface for doing authenticated encryption. The library is based on this Gist by James Tuley:, but modified slightly to only support the key based versions. Also it does not use the GCM version currently, so there are no external dependencies.

Build Status

Build status


Install via NuGet:

Install-Package AuthenticatedEncryption

More information

The library consists of a single static class. This makes it very easy to use. It uses Authenticated Encryption with Associated Data (AEAD), using the approach called “Encrypt then MAC” (EtM). It uses one key for the encryption part (cryptkey) and another key for the MAC part (authkey).

This is a simple example of encrypting and decrypting some string:

const string Input = "this is a test input string";
var cryptKey = AuthenticatedEncryption.NewKey();
var authKey = AuthenticatedEncryption.NewKey();

var cipherText = AuthenticatedEncryption.Encrypt(Input, cryptKey, authKey);
var plainText = AuthenticatedEncryption.Decrypt(cipherText, cryptKey, authKey);


You can’t perform that action at this time.