Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7858

Base64 empty string encoding issue

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.2.6
    • Fix Version/s: 3.2.7, 3.1.18
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Flags:
      Important

      Description

      char[] chunk = Base64Utility.encodeChunk("".getBytes(), 0, 0, true); // chunk  = null after evaluation
      

      According to https://tools.ietf.org/html/rfc4648#section-10

      10. Test Vectors

       
      BASE64("") = ""

       

      // 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;
          }
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                coheigea Colm O hEigeartaigh
                Reporter:
                amah Andriy
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: