using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
public static void Main()
var agentUserName="dogan";
var agentPassword="dogancanli";
var agentSecretKey="WRk2I/PTlJOXQgVs+3VfACZjxMudysF3Ap32g7xqyME=";
var referance="11609_202405061435391363b604_ma_2";
var concatenatedKeys=$"{referance}-{agentId}-{agentUserName}-{agentPassword}";
Console.WriteLine(GetComputedHmacSignatureString(agentSecretKey,concatenatedKeys));
private static string GetComputedHmacSignatureString(string secretKey, string concatenatedKeys)
var requestBody = Encoding.UTF8.GetBytes(concatenatedKeys);
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secretKey)))
byte[] hmacSignature = hmac.ComputeHash(requestBody);
return Convert.ToBase64String(hmacSignature);