Forum OpenACS Development: Re: ns_hmac and byte array

Collapse
4: Re: ns_hmac and byte array (response to 2)
Posted by Dave Bauer on
Gustaf, can you explain which code generates the "hmac key (len 4): ab cd 12 34" message? Thanks!
Collapse
5: Re: ns_hmac and byte array (response to 4)
Posted by Gustaf Neumann on
activate the line [1] in the source code, activate the function hexPrint (same file), recompile, reinstall, run the naviserver shell e.g. with "/usr/local/ns/bin/nsd -c" and type in the ns_hmac commands.

Do you see a different result, or do get the same result, but expecting a different one?

[1] https://bitbucket.org/naviserver/naviserver/src/227b2724a06eeab64a03c1e56d6d270a57e4d855/nsd/tclcrypto.c#lines-870

Collapse
6: Re: ns_hmac and byte array (response to 5)
Posted by Dave Bauer on
Gustaf,

I believe the result your code returns is the correct response.

My code is returning a different value, but it looks like its the same. I'll try adding the debugging code.
I checked and I am running Naviserver 4.99.16.

Collapse
7: Re: ns_hmac and byte array (response to 6)
Posted by Gustaf Neumann on
Dave, please test with 4.99.17 if possible (there were changes in the meantime, for both [1] and the crypto support in [2]. Upgrade could help. If not it might be a problem with the Tcl version.

[1] https://openacs.org/forums/message-view?message_id=5380070
[2] https://openacs.org/webpush-demo/webpush-demo.tcl

Collapse
8: Re: ns_hmac and byte array (response to 7)
Posted by Dave Bauer on
Gustaf, thank you!

I compiled Naviserver 4.99.17 with Tcl 8.5.19 to see if the issue resolved itself, and I am not getting the same result as your example.

It does appear the Naviserver version affected the results, and not the Tcl version.

Collapse
9: Re: ns_hmac and byte array (response to 8)
Posted by Gustaf Neumann on
Glad that this helped! Tcl bytearrays are more tricky than it looks at the first sight.

all the best
-g