AesBridge 2.0.0

dotnet add package AesBridge --version 2.0.0
                    
NuGet\Install-Package AesBridge -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AesBridge" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AesBridge" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AesBridge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AesBridge --version 2.0.0
                    
#r "nuget: AesBridge, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AesBridge@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AesBridge&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AesBridge&version=2.0.0
                    
Install as a Cake Tool

AesBridge .NET

NuGet Version Build Status

AesBridge is a modern, secure, and cross-language AES encryption library. It offers a unified interface for encrypting and decrypting data across multiple programming languages. Supports GCM, CBC, and legacy AES Everywhere modes.

This is the .NET implementation of the core project.
👉 Main repository: https://github.com/mervick/aes-bridge

Features

  • 🔐 AES-256 encryption in GCM (recommended) and CBC modes
  • 🌍 Unified cross-language design
  • 📦 Compact binary format or Base64 output
  • HMAC Integrity: CBC mode includes HMAC verification
  • 🔄 Backward Compatible: Supports legacy AES Everywhere format

Installation

Install the package via NuGet Package Manager Console:

Install-Package AesBridge

Or via .NET CLI:

dotnet add package AesBridge

Usage

using AesBridge;

// AES-GCM (recommended)
string gcmCiphertext = AesBridge.Gcm.Encrypt("My secret data", "MyStrongPass");
byte[] gcmPlaintext = AesBridge.Gcm.Decrypt(gcmCiphertext, "MyStrongPass");

// AES-CBC with HMAC validation
string cbcCiphertext = AesBridge.Cbc.Encrypt("My secret data", "MyStrongPass");
byte[] cbcPlaintext = AesBridge.Cbc.Decrypt(cbcCiphertext, "MyStrongPass");

API Reference

All core functions are available through the module AesBridge namespase.

GCM Mode

Galois/Counter Mode - AES 256 with Tag


AesBridge.Gcm.Encrypt

Encrypts data using a given passphrase, returning the encrypted result as a base64-encoded string

Parameters:

  • data: string or byte[] - Data to encrypt
  • passphrase: string or byte[] - Encryption passphrase

Returns: string - the encrypted data as a Base64-encoded string.

Overloads:

  • public static string Encrypt(byte[] data, byte[] passphrase)
  • public static string Encrypt(byte[] data, string passphrase)
  • public static string Encrypt(string data, byte[] passphrase)
  • public static string Encrypt(string data, string passphrase)

AesBridge.Gcm.EncryptBin

Encrypts data using a given passphrase, returning binary encrypted data

Parameters:

  • data: string or byte[] - Data to encrypt
  • passphrase: string or byte[] - Encryption passphrase

Returns: byte[] - encrypted data in binary format: salt + nonce + ciphertext + tag

Overloads:

  • public static byte[] EncryptBin(byte[] data, byte[] passphrase)
  • public static byte[] EncryptBin(byte[] data, string passphrase)
  • public static byte[] EncryptBin(string data, byte[] passphrase)
  • public static byte[] EncryptBin(string data, string passphrase)

AesBridge.Gcm.Decrypt

Decrypts Base64-encoded data using a given passphrase

Parameters:

  • data: string or byte[] - Data to decrypt in base64-encoded format
  • passphrase: string or byte[] - Encryption passphrase

Returns: byte[] - decrypted data

Overloads:

  • public static byte[] Decrypt(byte[] data, byte[] passphrase)
  • public static byte[] Decrypt(byte[] data, string passphrase)
  • public static byte[] Decrypt(string data, byte[] passphrase)
  • public static byte[] Decrypt(string data, string passphrase)

CBC Mode

Cipher Block Chaining with HMAC Verification - AES 256


AesBridge.Cbc.Encrypt

Encrypts data using a given passphrase, returning the encrypted result as a base64-encoded string

Parameters:

  • data: string or byte[] - Data to encrypt
  • passphrase: string or byte[] - Encryption passphrase

Returns: string - the encrypted data as a Base64-encoded string.

Overloads:

  • public static string Encrypt(byte[] data, byte[] passphrase)
  • public static string Encrypt(byte[] data, string passphrase)
  • public static string Encrypt(string data, byte[] passphrase)
  • public static string Encrypt(string data, string passphrase)

AesBridge.Cbc.EncryptBin

Encrypts data using a given passphrase, returning binary encrypted data

Parameters:

  • data: string or byte[] - Data to encrypt
  • passphrase: string or byte[] - Encryption passphrase

Returns: byte[] - encrypted data in binary format: salt + nonce + ciphertext + tag

Overloads:

  • public static byte[] EncryptBin(byte[] data, byte[] passphrase)
  • public static byte[] EncryptBin(byte[] data, string passphrase)
  • public static byte[] EncryptBin(string data, byte[] passphrase)
  • public static byte[] EncryptBin(string data, string passphrase)

AesBridge.Cbc.Decrypt

Decrypts Base64-encoded data using a given passphrase

Parameters:

  • data: string or byte[] - Data to decrypt in base64-encoded format
  • passphrase: string or byte[] - Encryption passphrase

Returns: byte[] - decrypted data

Overloads:

  • public static byte[] Decrypt(byte[] data, byte[] passphrase)
  • public static byte[] Decrypt(byte[] data, string passphrase)
  • public static byte[] Decrypt(string data, byte[] passphrase)
  • public static byte[] Decrypt(string data, string passphrase)

AesBridge.Cbc.DecryptBin

Decrypts binary data using a given passphrase

Parameters:

  • data: string or byte[] - Data to decrypt in binary format: salt + nonce + ciphertext + tag
  • passphrase: string or byte[] - Encryption passphrase

Returns: byte[] – decrypted data in binary form.

Overloads:

  • public static byte[] DecryptBin(byte[] data, byte[] passphrase)
  • public static byte[] DecryptBin(byte[] data, string passphrase)

Legacy mode

⚠️ These functions are maintained solely for compatibility with older systems. While they remain fully compatible with the legacy AES Everywhere implementation, their use is strongly discouraged in new applications due to potential security limitations compared to GCM or CBC with HMAC.


AesBridge.Legacy.Encrypt

Encrypts data using a given passphrase.

Parameters:

  • data: string or byte[] - Data to encrypt.
  • passphrase: string or byte[] - Encryption passphrase.

Returns: string - Encrypted data.

Overloads:

  • public static string Encrypt(byte[] data, byte[] passphrase)
  • public static string Encrypt(byte[] data, string passphrase)
  • public static string Encrypt(string data, byte[] passphrase)
  • public static string Encrypt(string data, string passphrase)

AesBridge.Legacy.Decrypt

Decrypts string data using a given passphrase.

Parameters:

  • data: string or byte[] - Data to decrypt in base64-encoded format
  • passphrase: string or byte[] - Encryption passphrase.

Returns: string - Decrypted data.

Overloads:

  • public static string Decrypt(byte[] data, byte[] passphrase)
  • public static string Decrypt(byte[] data, string passphrase)
  • public static string Decrypt(string data, byte[] passphrase)
  • public static string Decrypt(string data, string passphrase)

AesBridge.Legacy.DecryptToBytes

Decrypts string data to a byte array using a given passphrase.

Parameters:

  • data: string or byte[]- Data to decrypt in base64-encoded format
  • passphrase: string or byte[] - Encryption passphrase.

Returns: byte[] - Decrypted data as a byte array.

Overloads:

  • public static byte[] DecryptToBytes(byte[] data, byte[] passphrase)
  • public static byte[] DecryptToBytes(byte[] data, string passphrase)
  • public static byte[] DecryptToBytes(string data, byte[] passphrase)
  • public static byte[] DecryptToBytes(string data, string passphrase)
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 321 7/20/2025