private void putKeyStore(KeyStore keyStore, File keyStoreFile) throws AmbariException {
    LOG.debug("Writing key store to {}", keyStoreFile.getAbsolutePath());

    FileOutputStream outputStream = null;

    try {
      outputStream = new FileOutputStream(this.keyStoreFile);
      writeKeyStore(keyStore, outputStream);
    } catch (FileNotFoundException e) {
      throw new AmbariException(String.format("Failed to open the key store file: %s", e.getLocalizedMessage()), e);
    } finally {
      IOUtils.closeQuietly(outputStream);
    }
  }
Writes the specified KeyStore to a file.

@param keyStore     the KeyStore to write to a file
@param keyStoreFile the File in which to store the KeyStore data
@throws AmbariException if an error occurs while writing the KeyStore data
ambari-server/src/main/java/org/apache/ambari/server/security/encryption/FileBasedCredentialStore.java