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

Cannot import certain X.509 certficates with the Sun JCA implementation. Again.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.0.2, 1.3.0
    • security-libs
    • beta
    • generic
    • generic



      Name: boT120536 Date: 12/07/2000


      C:\out>java -version
      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)

      This is the second time. It wasn't accepted last time, although one of you guys
      (###@###.###) told me to report it. What was missing the last time
      was the certificate that failed. Since I can't send it through this bug report
      mechnaism, please email me to get a copy of it. The guy I emailed with on the
      sec_faq (Sean Mullan [###@###.###) also still have a copy of it I
      think.

      When importing certain X.509 certificates using the default Sun implementation
      an exception is thrown. But when I use another vendor's implemenation(E.g.
      Baltimore's JCrypt, IAIK) it works fine. Also Windows recognizes it as a valid
      certificate. (I have an idea what it might be. Comparing the certs that doesn't
      work with the ones that do, I could see the difference that non-functioning had
      the extensions: 'Subject Alternative Name' and Issuer Alternative Name', and
      they are set to 'No alternative name'. At least Windows says that. Since it is
      a nullpointerExc. in the error message, it might be that if "name" isn't
      checked for null)

      [Source]
       java.io.FileInputStream fi = new java.io.FileInputStream
      ("c://out//certs//cert.crt");
        java.io.DataInputStream dis = new java.io.DataInputStream(fi);

        byte[] cert = new byte[dis.available()];
        dis.readFully(cert);
        java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream( cert );

        java.security.cert.CertificateFactory cf =
        java.security.cert.CertificateFactory.getInstance("X.509");
        java.security.cert.Certificate c = cf.generateCertificate( bais );

      [Error message and trace]
      java.security.cert.CertificateParsingException: java.io.IOException:
      java.lang.NullPointerException:

      at sun.security.x509.X509CertInfo.<init>(X509CertInfo.java:161)

      at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1039)

      at sun.security.x509.X509CertImpl.<init>(X509CertImpl.java:150)

      at sun.security.provider.X509Factory.engineGenerateCertificate
      (X509Factory.java:93)

      at java.security.cert.CertificateFactory.generateCertificate
      (CertificateFactory.java:290)
      (Review ID: 113307)
      ======================================================================

            smalkanisunw Seema Malkani (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: