I need to sign a string using VB.NET. In C# the syntax would be :
string stringToSign = $"{method}\n\n\n{request.ContentLength}\n\n{request.ContentType}\n\n\n\n\n\n\n{headerResource}\n{urlResource}";
string signature = Convert.ToBase64String(hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign )));
The $
is not allowed in VB.NET. When I attempt the same in VB.NET the checksum is different. I guess the problem is the \n
, because when these are removed the sums match.I tries to escape the backslash by adding an extra \
before the \n
(\\n
).
I have searched but failed to find a good solution. Any ideas?