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

java.util.Base64 urlEncoder should omit padding

XMLWordPrintable

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

        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.

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

                Created:
                Updated:
                Resolved: