using System.Security.Cryptography;
public static void Main()
const string PublicKey = "eQQR7oqFcO3JqpYPJzla";
const string PrivateKey = "1W4iZHuS93WqBzuzGEiT";
var CustomerAccountNumber = "01";
var MSISDN = "201220247177";
var OperatorCode = "60201";
var SubscriptionPlanId = 82283;
var InitialPaymentProductId = "EgyMob-RE";
var InitialPaymentDate = "2021-09-15 12:00:00Z";
var ExecuteInitialPaymentNow = false;
var RecurringPaymentProductId = "EgyMob-RE";
var ProductCatalogName = "orangedirectbilling192021";
var ExecuteRecurringPaymentNow = false;
var ContractStartDate = "2021-09-15 12:00:00Z";
var ContractEndDate = "2022-09-15 12:00:00Z";
var AutoRenewContract = true;
var SendVerificationSMS = true;
var allowMultipleFreeStartPeriods = true;
var HeaderEnrichmentReferenceCode = "";
var message = CustomerAccountNumber + MSISDN + OperatorCode + SubscriptionPlanId.ToString() + InitialPaymentProductId + InitialPaymentDate + ExecuteInitialPaymentNow.ToString().ToLower() + RecurringPaymentProductId + ProductCatalogName + ExecuteRecurringPaymentNow.ToString().ToLower() + ContractStartDate + ContractEndDate + AutoRenewContract.ToString().ToLower() + Language.ToString() + SendVerificationSMS.ToString().ToLower() + allowMultipleFreeStartPeriods.ToString().ToLower() + HeaderEnrichmentReferenceCode + SmsId;
var digest = CalculateDigest(PublicKey, PrivateKey, message);
Console.WriteLine(digest);
public static string CalculateDigest(string publicKey, string privateKey, string message)
var hash = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(privateKey));
var correctHash = string.Join(string.Empty, hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(message)).Select(b => b.ToString("x2")));
digest = publicKey + ":" + correctHash;