public void createTrustStore(Path filePath, String password)
      throws GeneralSecurityException, IOException {
    KeyStore ks = KeyStore.getInstance("JKS");
    try (InputStream in = Files.newInputStream(filePath)) {
      ks.load(in, password.toCharArray());
    } catch (IOException e) {
      ks = createEmptyKeyStore();
    }
    for (Map.Entry<String, CertificateMaterial> cert : trustedCerts.entrySet()) {
      ks.setCertificateEntry(cert.getKey(), cert.getValue().getCertificate());
    }

    try (OutputStream out = Files.newOutputStream(filePath)) {
      ks.store(out, password.toCharArray());
    }
  }
The {@code CertStores} class encapsulates the key and trust stores typically used by various
components in a Geode cluster. It currently supports certificate collections for servers,
locators and clients. All certificates are signed by a single Root Certificate Authority.
geode-junit/src/main/java/org/apache/geode/cache/ssl/CertStores.java