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

Unable to import PCKS12[.p12] certificate into java keystore[cacerts]

XMLWordPrintable

    • 8
    • generic
    • generic

      FULL PRODUCT VERSION :
      Jre1.8.0.101, Jre1.8.0.101,Jre1.8.0.131

      ADDITIONAL OS VERSION INFORMATION :
      Windows 2008 enterprise R2 service pack1

      A DESCRIPTION OF THE PROBLEM :
      We are unable to import .p12 certificate as a result SSL communication is failing

      Signature-Algorithm: SHA256WITHRSA
      Public-Key: RSA 2048 bits

      REGRESSION. Last worked in version 7u80

      ADDITIONAL REGRESSION INFORMATION:
      we are able to import the same certificate in 1.7.0_X versions

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use Keytool to import .p12 certificate

      Signature-Algorithm: SHA256WITHRSA
      Public-Key: RSA 2048 bits

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      import should be successful
      ACTUAL -
      keytool error: java.lang.StringIndexOutOfBoundsException: String index out of ra
      nge: 0

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\Qumu\jre\jre\bin>keytool -v -importkeystore -srckeystore C:\Qumu\jre\jre\lib\
      security\GBWD2512130.p12 -srcstoretype PKCS12 -keystore C:\Qumu\jre\jre\lib\secu
      rity\cacerts
      Enter destination keystore password:
      Enter source keystore password:
      keytool error: java.lang.StringIndexOutOfBoundsException: String index out of ra
      nge: 0
      java.lang.StringIndexOutOfBoundsException: String index out of range: 0
              at java.lang.String.charAt(String.java:658)
              at java.security.PKCS12Attribute.<init>(PKCS12Attribute.java:88)
              at sun.security.pkcs12.PKCS12KeyStore.getAttributes(PKCS12KeyStore.java:
      1391)
              at sun.security.pkcs12.PKCS12KeyStore.engineGetEntry(PKCS12KeyStore.java
      :1287)
              at java.security.KeyStore.getEntry(KeyStore.java:1521)
              at sun.security.tools.keytool.Main.recoverEntry(Main.java:3200)
              at sun.security.tools.keytool.Main.doImportKeyStoreSingle(Main.java:1978
      )
              at sun.security.tools.keytool.Main.doImportKeyStoreAll(Main.java:2023)
              at sun.security.tools.keytool.Main.doImportKeyStore(Main.java:1935)
              at sun.security.tools.keytool.Main.doCommands(Main.java:1024)
              at sun.security.tools.keytool.Main.run(Main.java:343)
              at sun.security.tools.keytool.Main.main(Main.java:336)

      C:\Qumu\jre\jre\bin>java.lang.StringIndexOutOfBoundsException: String index out
      of range: 0

      REPRODUCIBILITY :
      This bug can be reproduced always.

        1. JI9047017.java
          1 kB
        2. testks.p12
          2 kB
        3. Certificate1 Attributes.txt
          0.8 kB
        4. Certificate2 Attributes.txt
          1.0 kB

            vinnie Vincent Ryan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: