code: private List<SFPair<Certificate, Certificate>> getPairIssuerSubject(
        List<Certificate> bcChain)
    {
      List<SFPair<Certificate, Certificate>> pairIssuerSubject = new ArrayList<>();
      for (int i = 0, len = bcChain.size(); i < len; ++i)
      {
        Certificate bcCert = bcChain.get(i);
        if (bcCert.getIssuer().equals(bcCert.getSubject()))
        {
          continue; // skipping ROOT CA
        }
        if (i < len - 1)
        {
          pairIssuerSubject.add(SFPair.of(bcChain.get(i + 1), bcChain.get(i)));
        }
        else
        {
          synchronized (ROOT_CA_LOCK)
          {
            // no root CA certificate is attached in the certificate chain, so
            // getting one from the root CA from JVM.
            Certificate issuer = ROOT_CA.get(bcCert.getIssuer().hashCode());
            if (issuer == null)
            {
              throw new RuntimeException("Failed to find the root CA.");
            }
            pairIssuerSubject.add(SFPair.of(issuer, bcChain.get(i)));
          }
        }
      }
      return pairIssuerSubject;
    }
docs: Creates a pair of Issuer and Subject certificates
  
  @param bcChain a list of bouncy castle Certificate
  @return a list of paif of Issuer and Subject certificates