using System.Security.Cryptography;
namespace AES256GCMDecrypt
static void Main(string[] args)
string encryptedString = "a6c0952b78967559-2953e738b9b005028bf4f6c0-7b8464d1ed75bc38b4503f6c8d25d6bfc22a19cc1a8a92bc6faa1ed6cd837b97072bc8e16fd95b6cfca67fccbad8fc";
string passphrase = "this-is-a-test-passphrase";
string[] splitStrs = encryptedString.Split('-');
byte[] salt = Convert.FromHexString(splitStrs[0]);
byte[] iv = Convert.FromHexString(splitStrs[1]);
byte[] encryptedData = Convert.FromHexString(splitStrs[2]);
byte[] tag = new byte[16];
Array.Copy(encryptedData, encryptedData.Length - 16, tag, 0, 16);
byte[] key = new Rfc2898DeriveBytes(passphrase, salt, 1000, HashAlgorithmName.SHA256).GetBytes(32);
AesGcm aesGcm = new AesGcm(key);
int textLength = encryptedData.Length;
byte[] plaintext = new byte[textLength];
aesGcm.Decrypt(iv, encryptedData, tag, plaintext);
string decryptedString = Encoding.UTF8.GetString(plaintext);
Console.WriteLine(decryptedString);