Skip to content

Instantly share code, notes, and snippets.

@lellis1936
lellis1936 / AESGCM.cs
Created November 2, 2019 15:56
GCM Encryption / Decryption on Windows .Net Full Framework
//Requires PInvoke.BCrypt
//Note that AES GCM encryption is included on .Net Core 3.0, but not in the full .Net framework.
//This implementation requires PInvoke.BCrypt, and reulies on the Windows CNG Bcrypt library which
//is available on Windows Vista or later. Note also the requirement for unsafe code.
//As coded requires VS 2015 / C#6 or above.
using System;
using PInvoke;
using static PInvoke.BCrypt;
using System.Security.Cryptography;