Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-4160

X509CertStoreSelector does not work as used in BC 1.51

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EJBCA 6.2.9
    • Component/s: None
    • Labels:
      None
    • Issue discovered during:
      Customer

      Description

      With current code:

      SignerInformation signer = (SignerInformation) o;
      JcaX509CertSelectorConverter conv = new JcaX509CertSelectorConverter();
      @SuppressWarnings("unchecked")
      List<X509CertificateHolder> certCollection = new ArrayList<X509CertificateHolder>(certs.getMatches(X509CertStoreSelector.getInstance(conv.getCertSelector(signer.getSID()))));
      usercert = new JcaX509CertificateConverter().getCertificate(certCollection.get(0));

      usercert gives error:

      15:24:23,493 ERROR [org.ejbca.extra.db.ExtRAMsgHelper] (EJB default - 9) Error verifying data : : java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.ArrayList.rangeCheck(ArrayList.java:635) [rt.jar:1.7.0_55]
      at java.util.ArrayList.get(ArrayList.java:411) [rt.jar:1.7.0_55]
      at org.ejbca.extra.db.ExtRAMsgHelper.verifySignature(ExtRAMsgHelper.java:225) [externalra-service.jar:]

      There is a better way that seems to work:

      SignerInformation signer = (SignerInformation) o;
      @SuppressWarnings("unchecked")
      List<X509CertificateHolder> certCollection = (List<X509CertificateHolder>)certs.getMatches(signer.getSID());
      usercert = new JcaX509CertificateConverter().getCertificate(certCollection.get(0));

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tomas Tomas Gustavsson
              Reporter:
              tomas Tomas Gustavsson
              Verified by:
              Mike Agrenius Kushner
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 3 minutes
                  3m