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

X500Principal decodes BMP strings incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 7u51
    • security-libs

      FULL PRODUCT VERSION :
      java version "1.7.0_45"
      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Win 7 64-bit SP1

      A DESCRIPTION OF THE PROBLEM :
      The sample program contains a DN using BMP strings. The getName() function seems to not realize that that this is UNICODE.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      CN=AہB\,
      ACTUAL -
      CN=\00A ?\00?\00B\00\,

      JDK 6 delivers
      CN= A ? ? B \,

      The question marks are OK, the come from Windows CLI but the \00 and spaces in JDK 6 are wrong

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.security.auth.x500.X500Principal;

      public class bug
      {
         public static void main (String[] args)
           {
              System.out.println (new javax.security.auth.x500.X500Principal (new byte[]{(byte)0x30,(byte)0x15,(byte)0x31,(byte)0x13,(byte)0x30,(byte)0x11,(byte)0x06,(byte)0x03,
                                                                                         (byte)0x55,(byte)0x04,(byte)0x03,(byte)0x1e,(byte)0x0a,(byte)0x00,(byte)0x41,(byte)0x20,
                                                                                         (byte)0xac,(byte)0x00,(byte)0xc5,(byte)0x00,(byte)0x42,(byte)0x00,(byte)0x2c}).getName ());
           }
      }
      ---------- END SOURCE ----------

            jnimeh Jamil Nimeh
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: