Adds UTF-8 encoding in Util base64 encode/decode#93
Adds UTF-8 encoding in Util base64 encode/decode#93pitbulk merged 1 commit intoSAML-Toolkits:masterfrom
Conversation
Default encoding used in Util.base64encoder() methods. This commits adds UTF-8 encoding in string <-> byte conversions. Added Util.toBytesUtf8(String) and Util.toStringUtf8(byte[]). No tests added for this one. It's a bit messy to test things that require the JVM defaults to change. We usually use code analysis tools to detect byte<->string conversion issues.
|
@miszobi are you ok with that change? |
|
Yup, looks okay to me. Was trying to figure out a way to break the tests by running using a different encoding over the weekend, but didn't get to it. Will submit a separate PR if I do that. @rembjo0 what encoding you're using that you run into issues, out of curiosity? |
|
@miszobi, CP1252, running on windows. Note that we suspected that this was causing the logout response signature verification to fail. But it turned out that the message contained only ascii and thus it made no difference. I do hope these methods will use a fixed encoding in the future as it removes the uncertainty. We do send the NameId in the LogoutRequest and this will be encoded in CP1252 without this patch. Everything has sensible names in this environment, but it would not surprise me if somebody figures out a way to add non-ascii chars to the NameId. |
|
Merged that, @miszobi your test on that will be welcomed. |
Default encoding used in Util.base64encoder() methods.
This commits adds UTF-8 encoding in string <-> byte conversions.
Added Util.toBytesUtf8(String) and Util.toStringUtf8(byte[]).
No tests added for this one. It's a bit messy to test
things that require the JVM defaults to change. We usually
use code analysis tools to detect byte<->string conversion
issues.