public static <T extends Certificate> void createTrustStore(String filename, String password, Map<String, T> certs)
      throws GeneralSecurityException, IOException {
    KeyStore ks = KeyStore.getInstance("JKS");
    try {
      FileInputStream in = new FileInputStream(filename);
      ks.load(in, password.toCharArray());
      in.close();
    } catch (EOFException e) {
      ks = createEmptyKeyStore();
    }
    for (Map.Entry<String, T> cert : certs.entrySet()) {
      ks.setCertificateEntry(cert.getKey(), cert.getValue());
    }
    saveKeyStore(ks, filename, password);
  }
Creates a keystore with a single key and saves it to a file.

@param filename String file to save
@param password String store password to set on keystore
@param keyPassword String key password to set on key
@param alias String alias to use for the key
@param privateKey Key to save in keystore
@param cert Certificate to use as certificate chain associated to key
@throws GeneralSecurityException for any error with the security APIs
@throws IOException if there is an I/O error saving the file
ambry-test-utils/src/main/java/com/github/ambry/commons/TestSSLUtils.java