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

X509CertInfo fails to add CertificateSubjectName object

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Win 7 x64. Latest updates are applied.

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Nothing special

      A DESCRIPTION OF THE PROBLEM :
      X509CertInfo instanse of the class cannot add CertificateSubjectName instance.

      REGRESSION. Last worked in version 7u51

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute following sample code. Result will be visible on the screen.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      X509CertInfo.add(...) method can add CertificateSubjectName instance as it could under JDK_7.
      ACTUAL -
      X509CertInfo.add(...) method cannot add CertificateSubjectName instance. Exception is thrown. This method works fine under JDK_7.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.security.cert.CertificateException: Subject class type invalid.
      at sun.security.x509.X509CertInfo.setSubject(X509CertInfo.java:888)
      at sun.security.x509.X509CertInfo.set(X509CertInfo.java:415)
      at azdefault.Jdk8Bug.main(Jdk8Bug.java:22)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package azdefault;

      import sun.security.x509.CertificateSubjectName;
      import sun.security.x509.X500Name;
      import sun.security.x509.X509CertInfo;

      public class Jdk8Bug {

          public static void main( String[] args ) throws Exception {
              X500Name sampleX500Name = new X500Name( "CN=Sample Common Name" );
              CertificateSubjectName subjNameVariable = new CertificateSubjectName( sampleX500Name );
              X509CertInfo info = new X509CertInfo();

              // This line works fine under JDK7 not only in such simple demo program but also in real world
              // certificate manipulation program.
              // This line fails under JDK8 with following exception:

              // Exception in thread "main" java.security.cert.CertificateException: Subject class type invalid.
              // at sun.security.x509.X509CertInfo.setSubject(X509CertInfo.java:888)
              // at sun.security.x509.X509CertInfo.set(X509CertInfo.java:415)
              // at azdefault.Jdk8Bug.main(Jdk8Bug.java:22)
              info.set( X509CertInfo.SUBJECT, subjNameVariable );
          }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use previous version of JDK.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: