Doing symmetric signature with HMAC256 in .NET

A symmetric signature allows the client and the server to sign or verify data integrity. It ensures that a participant that owns the signture key is the only one who can do the verification or the signature.


string data = "some data";
string signatureKey = "hello world";
byte[] _signatureKeyBytes = Encoding.ASCII.GetBytes(_signatureKey);
using HMACSHA256 hash = new (_signatureKeyBytes);            
byte[] signature = hash.ComputeHash(Encoding.ASCII.GetBytes(data));

Post a Comment

Previous Post Next Post