Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding issue when using CookieAuthenticator #1159

Closed
templth opened this issue Oct 9, 2015 · 1 comment
Closed

Encoding issue when using CookieAuthenticator #1159

templth opened this issue Oct 9, 2015 · 1 comment

Comments

@templth
Copy link
Collaborator

templth commented Oct 9, 2015

Arjohn Kampman found out a problem with encoding when trying to login using the CookieAuthenticator.

When the default encoding is latin1 and we want to use for example chinese characters, the latters won't be correctly decoded. The consequence here is that following calls won't be allowed...

See Arjohn's message of the mailling list:

We just ran into an issue with CookieAuthenticator not supporting various Unicode names and
passwords. We have debugged the issue to the encrypt() and decrypt() methods in CryptoUtils. These
methods converts byte[] to String and back again using the platform's default character encoding. If
that default encoding is ISO-8859-1, for example, decoding a cyrillic or Chinese character will result in
'?' characters in the resulting byte array.

A simple solution is to always use UTF-8 for the conversion:

  1. replace calls to String.getBytes() with String.getBytes(StandardCharsets.UTF_8)
  2. replace calls to constructor String(byte[]) with String(byte[], StandardCharsets.UTF_8)
@thboileau
Copy link
Contributor

will be part of 2.3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants