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

jarsigner does not sign UTF-8 classes which are split in more than one line

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 6, 6u26
    • security-libs
    • b25
    • x86
    • windows_xp, windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      When classes have names whose names span 2 bytes in UTF-8 encoding and the line breaks placed by in the manifest split the character in half (1st byte in one line, 2nd byte in continuation line) the class is not signed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Generate a keystore:

      > keytool -genkey -alias myalias -keypass mykeypass -storepass mystorepass -keystore keystore -dname "CN=Myself,OU=Me,O=People,L=Lisbon,C=PT"

      2. Create a text file

      "A1234567890B1234567890C1234567890D1234567890E1234567890F1234567éxyz.java" with the following contents (note the accented "e" before the final "xyz" in the file and class names):

      class A1234567890B1234567890C1234567890D1234567890E1234567890F1234567éxyz {}

      3. Compile the java file:

      > javac *.java

      4. Create a jar file:

      > jar cvf myjar.jar *.class

      5. Sign the jar file:

      jarsigner -keystore keystore -storepass mystorepass -keypass mykeypass myjar.jar myalias



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In the generated jar file, within the MANIFEST.MF the class' hash should appear. In the generated jar file, within the META-INF/MYALIAS.SF file, the class' signature should appear.

      ACTUAL -
      The generated META-INF/MYALIAS.SF file *will not* contain the signature for the class. If the "é" character is swaped with the "x" character (rename the file and the class "...xéyz" instead of "...éxyz"), the signature is generated.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class A1234567890B1234567890C1234567890D1234567890E1234567890F1234567éxyz {}
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Rename class files so that the characters than span more than 1 byte in UTF-8 encoding do not span more than one line in the generated manifest.

            weijun Weijun Wang
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: