You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Mahats (JIRA)" <ji...@apache.org> on 2018/10/02 07:46:00 UTC

[jira] [Commented] (CXF-7858) Base64 empty string encoding issue

    [ https://issues.apache.org/jira/browse/CXF-7858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16635109#comment-16635109 ] 

Andriy Mahats commented on CXF-7858:
------------------------------------

Hi! The decoding needs to be fixed too, I believe.
{code:java}
// org.apache.cxf.common.util.Base64Utility#decodeChunk
Base64Utility.decodeChunk("".toCharArray(), 0, "".toCharArray().length); // returns null
{code}

> Base64 empty string encoding issue
> ----------------------------------
>
>                 Key: CXF-7858
>                 URL: https://issues.apache.org/jira/browse/CXF-7858
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.2.6
>            Reporter: Andriy Mahats
>            Assignee: Colm O hEigeartaigh
>            Priority: Blocker
>             Fix For: 3.2.7, 3.1.18
>
>
> {code:java}
> char[] chunk = Base64Utility.encodeChunk("".getBytes(), 0, 0, true); // chunk  = null after evaluation
> {code}
> According to [https://tools.ietf.org/html/rfc4648#section-10]
> h2. [10|https://tools.ietf.org/html/rfc4648#section-10]. Test Vectors
>  
>  BASE64("") = ""
>  
> {code:java}
> // later it evaluates to null
> //org.apache.cxf.common.util.Base64UrlUtility#encodeChunk
>  public static String encodeChunk(byte[] id, int offset, int length) {
>         char[] chunk = Base64Utility.encodeChunk(id, offset, length, true);
>         return chunk != null ? new String(chunk) : null;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)