Your code basically looks correct, even the first version should work. I believe it’s the data conversions you should look into. I don’t know where exactly the difference is, but try to save your byte array into a binary file, for example. Do it in both C# application and NAV, and compare the result. And to be confident, compare the key the same way. It looks like Encoding.UTF8.GetBytes yields different results for a .Net string and NAV Text.