I am moving / converting / rebuilding a Windows Phone 7.1 application into a Windows 8 storage application.
One method that I use in a WP7 application gives me problems:
private byte[] GetSHA256Key(string data, string secretKey) { byte[] value = Encoding.UTF8.GetBytes(data); byte[] secretKeyBytes = Encoding.UTF8.GetBytes(secretKey); HMACSHA256 hmacsha256 = new HMACSHA256(secretKeyBytes); byte[] resultBytes = hmacsha256.ComputeHash(value); return resultBytes; }
Looking at the documentation for the Windows Store apps, I came up with this new code, which I hoped would produce the same result. But no. I'm doing something wrong. But what?
private byte[] GetSHA256Key(string value, string secretKey) {
I am not a specialist in cryptography. I'm not sure what I'm doing. Maybe there is someone who can help me.
Thanx, in JP
c # cryptography windows-phone-7 microsoft-metro
JP Sonnemans
source share