Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8026330

java.util.Base64 urlEncoder should omit padding

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 8
    • 8
    • core-libs
    • b117
    • linux
    • Verified

    Backports

      Description

        A DESCRIPTION OF THE REQUEST :

        java.util.Base64.getUrlEncoder() should not apply padding at the end of encoding.

        Alternatively, padding control should be exposed as an option. There are several variants of base64 encoding where padding should be omitted: http://en.wikipedia.org/wiki/Base64#Variants_summary_table


        JUSTIFICATION :
        This is a fairly common scenario. In base64url encoding padding is usually omitted. It is certainly optional and if present should actually be URL encoded as %3D.

        Thus, the default behavior of Base64.getUrlEncoder should be changed to omit padding.




        CUSTOMER SUBMITTED WORKAROUND :

        One could keep using the various libraries available that support this properly (eg. Guava, Apache Commons, etc), but this defeats the purpose of having this functionality in the JDK.

        Attachments

          Issue Links

            Activity

              People

                sherman Xueming Shen
                igerasim Ivan Gerasimov
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: