Join GitHub today
Crypto - sign.update, verifier.update default parameter for strings 'utf8' not really true? #7712
I found if I didn't specify that parameter the calculated signature would be incorrect (not matching a standard implementation using Bouncy Castle crypto apis in Windows) if there were any unicode characters in the source string to be signed.
If I specified the parameter utf8 then it worked correctly both ways between Bouncy Castle's crypto apis in windows and Node crytpo under linux.
Same issue with verifier.update was found as well.
I suggest the docs should be updated to specify that it's (likely) binary by default if it's a string or a buffer or the sign.update and verifier.update code changed to act as documented.
Here is a snippet of code I was using for testing:
changed the title
Crypto - sign.update, verifier.update default parameter for strings not really true?
Jul 13, 2016
Doh! I'm very sorry about that, I forgot how old the packaged Node is with Debian. Thank you for your patience.
Just FYI those node 4 docs actually say the same thing, perhaps those docs need to be updated?: