All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.keycloak.util.KeystoreUtil Maven / Gradle / Ivy

package org.keycloak.util;

import java.io.File;
import java.io.FileInputStream;
import java.security.KeyStore;

/**
 * @author Bill Burke
 * @version $Revision: 1 $
 */
public class KeystoreUtil {
    public static KeyStore loadKeyStore(String filename, String password) throws Exception {
        KeyStore trustStore = KeyStore.getInstance(KeyStore
                .getDefaultType());
        File truststoreFile = new File(filename);
        FileInputStream trustStream = new FileInputStream(truststoreFile);
        trustStore.load(trustStream, password.toCharArray());
        trustStream.close();
        return trustStore;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy