Search in sources :

Example 6 with KeyStoreManager

use of org.obiba.security.KeyStoreManager in project mica2 by obiba.

the class KeyStoreService method deleteKeyPair.

public void deleteKeyPair(String name, String alias) {
    KeyStoreManager ksm = getKeyStore(name);
    if (ksm.hasKeyPair(alias)) {
        ksm.deleteKey(alias);
        saveKeyStore(ksm);
    }
}
Also used : KeyStoreManager(org.obiba.security.KeyStoreManager)

Example 7 with KeyStoreManager

use of org.obiba.security.KeyStoreManager in project mica2 by obiba.

the class SslContextFactoryImpl method createSslContext.

@Override
public SSLContext createSslContext() {
    KeyStoreManager keystore = prepareServerKeystore();
    try {
        SSLContext ctx = SSLContext.getInstance("TLSv1.2");
        ctx.init(new KeyManager[] { new X509ExtendedKeyManagerImpl(keystore) }, null, null);
        return ctx;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : KeyStoreManager(org.obiba.security.KeyStoreManager) SSLContext(javax.net.ssl.SSLContext) X509ExtendedKeyManagerImpl(org.obiba.ssl.X509ExtendedKeyManagerImpl)

Aggregations

KeyStoreManager (org.obiba.security.KeyStoreManager)7 OpalCredential (org.obiba.mica.micaConfig.domain.OpalCredential)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 SSLContext (javax.net.ssl.SSLContext)1 Test (org.junit.Test)1 OpalJavaClient (org.obiba.opal.rest.client.magma.OpalJavaClient)1 X509ExtendedKeyManagerImpl (org.obiba.ssl.X509ExtendedKeyManagerImpl)1