Search in sources :

Example 1 with UnifiedX509KeyManager

use of com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager in project Payara by payara.

the class SecuritySupportImpl method getKeyManagers.

public KeyManager[] getKeyManagers(String algorithm) throws IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
    KeyStore[] kstores = getKeyStores();
    ArrayList<KeyManager> keyManagers = new ArrayList<KeyManager>();
    for (int i = 0; i < kstores.length; i++) {
        checkCertificateDates(kstores[i]);
        KeyManagerFactory kmf = KeyManagerFactory.getInstance((algorithm != null) ? algorithm : KeyManagerFactory.getDefaultAlgorithm());
        kmf.init(kstores[i], keyStorePasswords.get(i));
        KeyManager[] kmgrs = kmf.getKeyManagers();
        if (kmgrs != null) {
            keyManagers.addAll(Arrays.asList(kmgrs));
        }
    }
    KeyManager keyManager = new UnifiedX509KeyManager(keyManagers.toArray(new X509KeyManager[keyManagers.size()]), getTokenNames());
    return new KeyManager[] { keyManager };
}
Also used : UnifiedX509KeyManager(com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager) ArrayList(java.util.ArrayList) X509KeyManager(javax.net.ssl.X509KeyManager) UnifiedX509KeyManager(com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager) KeyStore(java.security.KeyStore) X509KeyManager(javax.net.ssl.X509KeyManager) UnifiedX509KeyManager(com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager) KeyManager(javax.net.ssl.KeyManager) KeyManagerFactory(javax.net.ssl.KeyManagerFactory)

Aggregations

UnifiedX509KeyManager (com.sun.enterprise.security.ssl.manager.UnifiedX509KeyManager)1 KeyStore (java.security.KeyStore)1 ArrayList (java.util.ArrayList)1 KeyManager (javax.net.ssl.KeyManager)1 KeyManagerFactory (javax.net.ssl.KeyManagerFactory)1 X509KeyManager (javax.net.ssl.X509KeyManager)1