how do i calculate md5 message digest for message attributes?

You are almost there but missing one step:

Encode the transport type (String or Binary) of the value (1 byte).

Note The logical data types String and Number use the String transport type.

The logical data type Binary uses the Binary transport type.

For the String transport type, encode 1.

For the Binary transport type, encode 2.

So you need to append either 1 or 2 before value, to indicate transport type. In your case:

var verifyMessageAttributes = new List<byte>();
verifyMessageAttributes.AddRange(EncodeString("UserName"));
verifyMessageAttributes.AddRange(EncodeString("String"));
verifyMessageAttributes.Add(1); // < here
verifyMessageAttributes.AddRange(EncodeString("Me"));
var verifyMessageAttributesMd5 = GetMd5Hash(verifyMessageAttributes.ToArray());

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top