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

Unparseable CRL Distribution Points certificate extension within the JApplet

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.2
    • security-libs

      FULL PRODUCT VERSION :
      1.4.2_05, 1.5.0._04, 1.6.0-beta

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

      A DESCRIPTION OF THE PROBLEM :
      CRL Distribution Points certificate extension is not parsed within the JApplet.
      Reference: Bug #4874076.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run both the stand-alone version of the application and the JApplet version (see source code).
      2. Provide to the program an X.509 certificate with a CRL Distribution Points certificate extension by using the "Read Certificate" button.
      3. Compare the content of the certificate by reading the data from the text area in the stand-alone and JApplet versions of the program (the content of the CRL Distribution Point extension).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      CRL Distribution Points certificate extension must be parsed within the JApplet application like within the stand-alone application.
      ACTUAL -
      Unparseable certificate extensions: 1
      [1]: ObjectId: 2.5.29.31 Criticality=false
      0000: 30 81 E9 30 81 E6 A0 6A A0 68 86 35 6C 64 61 70 0..0...j.h.5ldap
      0010: 3A 2F 2F 70 6B 73 6C 64 61 70 2E 74 74 74 63 2E ://pksldap.tttc.
      0020: 64 65 3A 33 38 39 2F 6F 3D 44 65 75 74 73 63 68 de:389/o=Deu
      0030: 65 20 54 65 6C 65 6B 6F 6D 20 41 47 2C 63 3D 64 ,c=d
      0040: 65 86 2F 68 74 74 70 3A 2F 2F 77 77 77 2E 74 74 e./http://www.ttasd
      0050: 74 63 2E 64 65 2F 74 65 6C 65 73 65 63 2F 73 65 tc.de/t/se
      0060: 72 76 6C 65 74 2F 64 6F 77 6E 6C 6F 61 64 5F 63 rvlet/download_c
      0070: 72 6C A2 78 A4 76 30 74 31 0B 30 09 06 03 55 04 rl.x.v0t1.0...U.
      0080: 06 13 02 44 45 31 1C 30 1A 06 03 55 04 0A 14 13 ...DE1.0...U....
      0090: 44 65 75 74 73 63 68 65 20 54 65 6C 65 6B 6F 6D Deut Tem
      00A0: 20 41 47 31 17 30 15 06 03 55 04 0B 14 0E 54 2D 1.0...U....
      00B0: 54 65 6C 65 53 65 63 20 54 65 73 74 31 2E 30 0C Test1.0.
      00C0: 06 07 02 82 06 01 0A 07 14 13 01 31 30 1E 06 03 ...........10...
      00D0: 55 04 03 14 17 54 2D 54 65 6C 65 53 65 63 20 54 U....00E0:
      65 73 74 20 44 49 52 20 38 3A 50 4E est DIR 8:PN


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There are no any explicit errors, just a message: "Unparseable certificate extensions".

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      There are two versions of the application source code: stand-alone and JApplet (CRLDPFrame and CRLDPApplet classes):

      1. CRLDPFrame source code:

      public class CRLDPFrame extends JFrame
      {
      private JTextField crtPathField;
      private JButton browseBtn;
      private JTextArea resultArea;

      public CRLDPFrame()
      {
      setTitle("CRLDP Bug");
      setSize(400, 300);
      setDefaultCloseOperation(EXIT_ON_CLOSE);

      addComponents();

      }

      public void addComponents()
      {
      crtPathField = new JTextField(20);
      browseBtn = new JButton("Read Certificate...");
      browseBtn.addActionListener(new BL());
      JPanel p1 = new JPanel();
      p1.add(crtPathField);
      p1.add(browseBtn);

      resultArea = new JTextArea(40, 50);
      resultArea.setLineWrap(true);
      JScrollPane jsp = new JScrollPane(resultArea);
      jsp.setPreferredSize(new Dimension(380,200));

      JPanel p2 = new JPanel();
      p2.add(jsp);

      Container cp = getContentPane();
      cp.add(p1, BorderLayout.NORTH);
      cp.add(p2);

      }

      private void readCertificate(File crtPath)
      {
      try
      {
      CertificateFactory certFactory = CertificateFactory.getInstance("X.509");

      FileInputStream fin;
      fin = new FileInputStream(crtPath);
      Certificate certificate = certFactory.generateCertificate(fin);
      fin.close();

      crtPathField.setText(crtPath.getPath());
      resultArea.setText(certificate.toString());
      System.out.println(certificate.toString());

      }
      catch (Exception e)
      {
      resultArea.setText("An error has been occured while certificate reading!");
      e.printStackTrace();
      }
      }

      private class BL implements ActionListener
      {
      public void actionPerformed(ActionEvent e)
      {
      JFileChooser fc = new JFileChooser(new File("d:\\"));

      int response = fc.showOpenDialog(CRLDPFrame.this);

      if (response == JFileChooser.APPROVE_OPTION)
      {
      CRLDPFrame.this.readCertificate(fc.getSelectedFile());
      }
      }
      }

      public static void main(String[] args)
      {
      new CRLDPFrame().setVisible(true);
      }
      }

      2. CRLDPApplet source code

      public class CRLDPApplet extends JApplet
      {
      private JTextField crtPathField;
      private JButton browseBtn;
      private JTextArea resultArea;

      public void init()
      {
      addComponents();
      }

      public void addComponents()
      {
      crtPathField = new JTextField(20);
      browseBtn = new JButton("Read Certificate...");
      browseBtn.addActionListener(new BL());
      JPanel p1 = new JPanel();
      p1.add(crtPathField);
      p1.add(browseBtn);

      resultArea = new JTextArea(40, 50);
      resultArea.setLineWrap(true);
      JScrollPane jsp = new JScrollPane(resultArea);
      jsp.setPreferredSize(new Dimension(380, 200));

      JPanel p2 = new JPanel();
      p2.add(jsp);

      Container cp = getContentPane();
      cp.add(p1, BorderLayout.NORTH);
      cp.add(p2);

      }

      private void readCertificate(File crtPath)
      {
      try
      {
      CertificateFactory certFactory = CertificateFactory.getInstance("X.509");

      FileInputStream fin;
      fin = new FileInputStream(crtPath);
      Certificate certificate = certFactory.generateCertificate(fin);
      fin.close();

      crtPathField.setText(crtPath.getPath());
      resultArea.setText(certificate.toString());
      System.out.println(certificate.toString());

      }
      catch (Exception e)
      {
      resultArea.setText("An error has been occured while certificate reading!");
      e.printStackTrace();
      }
      }

      private class BL implements ActionListener
      {
      public void actionPerformed(ActionEvent e)
      {
      JFileChooser fc = new JFileChooser(new File("d:\\"));

      int response = fc.showOpenDialog(CRLDPApplet.this);

      if (response == JFileChooser.APPROVE_OPTION)
      {
      CRLDPApplet.this.readCertificate(fc.getSelectedFile());
      }
      }
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No any workarounds where found by using the pure JDK. Of course I can use a different JCE provider to solve the problem, but that seems to be not good idea.

            juh Jason Uh (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: