code: public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert)
              throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException {
          InputStream is = new FileInputStream(pCaCert);
          try {
              CertificateFactory certFactory = CertificateFactory.getInstance("X509");
              X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is);
  
              String alias = cert.getSubjectX500Principal().getName();
              pTrustStore.setCertificateEntry(alias, cert);
          } finally {
              is.close();
          }
      }
docs: Update a keystore with a CA certificate
  
  @param pTrustStore the keystore to update
  @param pCaCert     CA cert as PEM used for the trust store