Re:HMAC signatures in Java
by bazzargh on Monday July 23, 2012 @12:06PM
(#4281636)
You're still doing it wrong. Look at the last line of my code snippet.
The code you've used will encode to hex bytes in UTF-8, but then you turn that into a string with the platform default character set, which may not be compatible (eg: any double-byte encoding). Use the method that Hex provides. If you really need to you can do new String(bytes, hex.getCharEncoding()), but it's needless complexity.
The code you've used will encode to hex bytes in UTF-8, but then you turn that into a string with the platform default character set, which may not be compatible (eg: any double-byte encoding). Use the method that Hex provides. If you really need to you can do new String(bytes, hex.getCharEncoding()), but it's needless complexity.