Search in sources :

Example 1 with ManagedSecretKey

use of org.platformlayer.ops.crypto.ManagedSecretKey in project platformlayer by platformlayer.

the class StandardTemplateData method findPublicSslKey.

public ManagedSecretKey findPublicSslKey() throws OpsException {
    PlatformLayerKey sslKey = getSslKeyPath();
    if (sslKey == null) {
        if (getCaPath() != null) {
            ManagedSecretKey key = findCaSignedKey("public");
            if (key != null) {
                return key;
            }
        }
        return null;
    }
    ItemBase sslKeyItem = (ItemBase) platformLayer.getItem(sslKey);
    ManagedSecretKey key = providers.toInterface(sslKeyItem, ManagedSecretKey.class);
    return key;
}
Also used : ItemBase(org.platformlayer.core.model.ItemBase) ManagedSecretKey(org.platformlayer.ops.crypto.ManagedSecretKey) PlatformLayerKey(org.platformlayer.core.model.PlatformLayerKey)

Example 2 with ManagedSecretKey

use of org.platformlayer.ops.crypto.ManagedSecretKey in project platformlayer by platformlayer.

the class StandardServiceInstance method createKeystore.

private void createKeystore(StandardTemplateData template) throws OpsException {
    ManagedDirectory configDir = findDirectory(template.getConfigDir());
    File keystoreFile = template.getKeystoreFile();
    if (template.shouldCreateSslKey()) {
        // TODO: Unify with additional keys?
        // But be careful.. this is normally a shared key across all instances
        ManagedKeystore httpsKey = configDir.addChild(ManagedKeystore.class);
        httpsKey.path = keystoreFile;
        httpsKey.tagWithPublicKeys = template.getModel();
        httpsKey.alias = ManagedKeystore.DEFAULT_WEBSERVER_ALIAS;
        httpsKey.key = template.findPublicSslKey();
    }
    Map<String, ManagedSecretKey> keys = Maps.newHashMap();
    template.getAdditionalKeys(keys);
    for (Entry<String, ManagedSecretKey> entry : keys.entrySet()) {
        ManagedKeystore httpsKey = configDir.addChild(ManagedKeystore.class);
        httpsKey.path = keystoreFile;
        // httpsKey.tagWithPublicKeys = template.getModel();
        httpsKey.alias = entry.getKey();
        httpsKey.key = entry.getValue();
    }
    addExtraKeys(configDir, keystoreFile);
}
Also used : ManagedKeystore(org.platformlayer.ops.crypto.ManagedKeystore) ManagedDirectory(org.platformlayer.ops.filesystem.ManagedDirectory) ManagedSecretKey(org.platformlayer.ops.crypto.ManagedSecretKey) File(java.io.File)

Example 3 with ManagedSecretKey

use of org.platformlayer.ops.crypto.ManagedSecretKey in project platformlayer by platformlayer.

the class StandardTemplateData method findCaKey.

public ManagedSecretKey findCaKey() throws OpsException {
    PlatformLayerKey caPath = getCaPath();
    if (caPath == null) {
        return null;
    }
    ItemBase sslKeyItem = (ItemBase) platformLayer.getItem(caPath);
    ManagedSecretKey key = providers.toInterface(sslKeyItem, ManagedSecretKey.class);
    return key;
}
Also used : ItemBase(org.platformlayer.core.model.ItemBase) ManagedSecretKey(org.platformlayer.ops.crypto.ManagedSecretKey) PlatformLayerKey(org.platformlayer.core.model.PlatformLayerKey)

Aggregations

ManagedSecretKey (org.platformlayer.ops.crypto.ManagedSecretKey)3 ItemBase (org.platformlayer.core.model.ItemBase)2 PlatformLayerKey (org.platformlayer.core.model.PlatformLayerKey)2 File (java.io.File)1 ManagedKeystore (org.platformlayer.ops.crypto.ManagedKeystore)1 ManagedDirectory (org.platformlayer.ops.filesystem.ManagedDirectory)1