use of com.emc.storageos.security.keystore.impl.KeystoreEngine in project coprhd-controller by CoprHD.
the class CassandraKeystoreHandler method saveTrustStore.
public void saveTrustStore() throws Exception {
log.info("Trying to generate truststore {}", trustStoreFile);
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, password);
DistributedLoadKeyStoreParam loadStoreParam;
loadStoreParam = new DistributedLoadKeyStoreParam();
loadStoreParam.setCoordinator(coordinator);
KeystoreEngine ksEngine = new KeystoreEngine();
ksEngine.engineLoad(loadStoreParam);
Enumeration<String> allAliases = ksEngine.engineAliases();
while (allAliases.hasMoreElements()) {
String alias = (String) allAliases.nextElement();
KeyStore.TrustedCertificateEntry trustedCertEntry = new KeyStore.TrustedCertificateEntry(keystore.getCertificate(alias));
ks.setEntry(alias, trustedCertEntry, null);
}
ks.store(new FileOutputStream(trustStoreFile), password);
setFilePermission(trustStoreFile);
log.info("The truststore file {} is generated successfully.", trustStoreFile);
}
Aggregations