SSLParameters.setApplicationProtocols() ALPN example could be clarified

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 25
    • Affects Version/s: 17
    • Component/s: security-libs

      The following example added to javax.net.ssl.SSLParameters:

           * // MEETEI MAYEK LETTERS HUK UN I (Unicode 0xabcd->0xabcf): 2 bytes
           * byte[] bytes = "\u005cuabcd\u005cuabce\u005cuabcf"
           * .getBytes(StandardCharsets.UTF_8);
           * String HUK_UN_I = new String(bytes, StandardCharsets.ISO_8859_1);
           *
           * // 0x00-0xFF: 1 byte
           * String rfc7301Grease8A = "\u005cu008A\u005cu008A";

      The intent was:

           . Each Unicode character (0xabcd->0xabcf) is represented in the string using 2 bytes.
          . This is converted using UTF_8 into a byte array, which takes 3 bytes for each character.
          . This 9 byte array is then output as ISO_8859_1 during the ALPN negotiation.

      Tweak the example to better explain this.

      Also, the wrong RFC number was used for the GREASE example. It should be RFC 8701.

            Assignee:
            Bradford Wetmore
            Reporter:
            Bradford Wetmore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: