Search in sources :

Example 1 with DistributedLoadKeyStoreParam

use of com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam in project coprhd-controller by CoprHD.

the class KeystoreTest method setup.

@Before
public void setup() throws URISyntaxException, IOException {
    ApplicationContextUtil.initContext(System.getProperty("buildType"), ApplicationContextUtil.SECURITY_CONTEXTS);
    List<URI> uri = new ArrayList<URI>();
    uri.add(URI.create(coordinatorServer));
    ZkConnection connection = new ZkConnection();
    connection.setServer(uri);
    connection.build();
    coordinatorClient.setZkConnection(connection);
    CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
    map.setNodeId("standalone");
    DualInetAddress localAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
    map.setDualInetAddress(localAddress);
    Map<String, DualInetAddress> controllerNodeIPLookupMap = new HashMap<String, DualInetAddress>();
    controllerNodeIPLookupMap.put("localhost", localAddress);
    map.setControllerNodeIPLookupMap(controllerNodeIPLookupMap);
    coordinatorClient.setInetAddessLookupMap(map);
    coordinatorClient.start();
    FileInputStream is = new FileInputStream(defaultOvfPropsLocation);
    Properties defaultProp = new Properties();
    defaultProp.load(is);
    is.close();
    is = new FileInputStream(ovfPropsLocation);
    Properties ovfProps = new Properties();
    ovfProps.load(is);
    is.close();
    CoordinatorClientImpl.setDefaultProperties(defaultProp);
    CoordinatorClientImpl.setOvfProperties(ovfProps);
    loadStoreParam = new DistributedLoadKeyStoreParam();
    loadStoreParam.setCoordinator(coordinatorClient);
    invalidLoadStoreParam = new LoadStoreParameter() {

        @Override
        public ProtectionParameter getProtectionParameter() {
            return null;
        }
    };
    gen = new KeyCertificatePairGenerator();
    KeyCertificateAlgorithmValuesHolder values = new KeyCertificateAlgorithmValuesHolder(coordinatorClient);
    gen.setKeyCertificateAlgorithmValuesHolder(values);
}
Also used : HashMap(java.util.HashMap) DistributedLoadKeyStoreParam(com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam) ArrayList(java.util.ArrayList) Properties(java.util.Properties) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection) FileInputStream(java.io.FileInputStream) LoadStoreParameter(java.security.KeyStore.LoadStoreParameter) KeyCertificateAlgorithmValuesHolder(com.emc.storageos.security.keystore.impl.KeyCertificateAlgorithmValuesHolder) KeyCertificatePairGenerator(com.emc.storageos.security.keystore.impl.KeyCertificatePairGenerator) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) ProtectionParameter(java.security.KeyStore.ProtectionParameter) Before(org.junit.Before)

Example 2 with DistributedLoadKeyStoreParam

use of com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam in project coprhd-controller by CoprHD.

the class TrustManagerTest method setup.

@Before
public void setup() throws IOException, URISyntaxException {
    ApplicationContextUtil.initContext(System.getProperty("buildType"), ApplicationContextUtil.SECURITY_CONTEXTS);
    List<URI> uri = new ArrayList<URI>();
    uri.add(URI.create(coordinatorServer));
    ZkConnection connection = new ZkConnection();
    connection.setServer(uri);
    connection.build();
    coordinatorClient.setZkConnection(connection);
    CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
    map.setNodeId("standalone");
    DualInetAddress localAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
    map.setDualInetAddress(localAddress);
    Map<String, DualInetAddress> controllerNodeIPLookupMap = new HashMap<String, DualInetAddress>();
    controllerNodeIPLookupMap.put("localhost", localAddress);
    map.setControllerNodeIPLookupMap(controllerNodeIPLookupMap);
    coordinatorClient.setInetAddessLookupMap(map);
    coordinatorClient.start();
    FileInputStream is = new FileInputStream(defaultOvfPropsLocation);
    Properties defaultProp = new Properties();
    defaultProp.load(is);
    is.close();
    is = new FileInputStream(ovfPropsLocation);
    Properties ovfProps = new Properties();
    ovfProps.load(is);
    is.close();
    CoordinatorClientImpl.setDefaultProperties(defaultProp);
    CoordinatorClientImpl.setOvfProperties(ovfProps);
    loadStoreParam = new DistributedLoadKeyStoreParam();
    loadStoreParam.setCoordinator(coordinatorClient);
}
Also used : HashMap(java.util.HashMap) DistributedLoadKeyStoreParam(com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam) ArrayList(java.util.ArrayList) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) Properties(java.util.Properties) URI(java.net.URI) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress) FileInputStream(java.io.FileInputStream) Before(org.junit.Before)

Example 3 with DistributedLoadKeyStoreParam

use of com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam 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);
}
Also used : DistributedLoadKeyStoreParam(com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam) FileOutputStream(java.io.FileOutputStream) KeyStore(java.security.KeyStore) KeystoreEngine(com.emc.storageos.security.keystore.impl.KeystoreEngine)

Aggregations

DistributedLoadKeyStoreParam (com.emc.storageos.security.keystore.impl.DistributedLoadKeyStoreParam)3 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)2 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)2 ZkConnection (com.emc.storageos.coordinator.common.impl.ZkConnection)2 FileInputStream (java.io.FileInputStream)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Properties (java.util.Properties)2 Before (org.junit.Before)2 KeyCertificateAlgorithmValuesHolder (com.emc.storageos.security.keystore.impl.KeyCertificateAlgorithmValuesHolder)1 KeyCertificatePairGenerator (com.emc.storageos.security.keystore.impl.KeyCertificatePairGenerator)1 KeystoreEngine (com.emc.storageos.security.keystore.impl.KeystoreEngine)1 FileOutputStream (java.io.FileOutputStream)1 KeyStore (java.security.KeyStore)1 LoadStoreParameter (java.security.KeyStore.LoadStoreParameter)1 ProtectionParameter (java.security.KeyStore.ProtectionParameter)1