code: public static List<Certificate> loadCertificates(final Reader reader) throws IOException,
              CertificateException {
          try (PEMParser pemParser = new PEMParser(reader)) {
              List<Certificate> certificates = new ArrayList<>();
  
              JcaX509CertificateConverter certificateConverter = new JcaX509CertificateConverter()
                      .setProvider(BouncyCastleProvider.PROVIDER_NAME);
              Object certObj = pemParser.readObject();
  
              if (certObj instanceof X509CertificateHolder) {
                  X509CertificateHolder certificateHolder = (X509CertificateHolder) certObj;
                  certificates.add(certificateConverter.getCertificate(certificateHolder));
              }
  
              return certificates;
          }
      }
docs: "cert.pem" from reader