jersey icon indicating copy to clipboard operation
jersey copied to clipboard

Base64 encoding with non ASCII characters results in ArrayIndexOutOfBoundException

Open mdurawa opened this issue 6 years ago • 0 comments

To calculate the authentication string in org.glassfish.jersey.client.authentication.BasicAuthenticator the method org.glassfish.jersey.internal.util.Base64.encodeAsString() is used to do the Base64 encoding. Unfortunately this results in a ArrayIndexOutOfBoundException when the password contains non ASCII characters like § (the paragraph sign) or a German Umlaut.

Some examples:

  • Base64.encodeAsString(new byte[]{(byte)128})
  • Base64.encodeAsString("§")

mdurawa avatar Apr 09 '18 12:04 mdurawa