Java Key Create getKeyStore(String keystorePath, String keystorePassword)

Here you can find the source of getKeyStore(String keystorePath, String keystorePassword)

Description

get Key Store

License

Open Source License

Declaration

private static KeyStore getKeyStore(String keystorePath,
            String keystorePassword) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;

public class Main {
    private static KeyStore getKeyStore(String keystorePath,
            String keystorePassword) {
        try {//from   w w  w. ja  va2s. com
            KeyStore keystore = KeyStore.getInstance(KeyStore
                    .getDefaultType());
            keystore.load(new FileInputStream(keystorePath),
                    keystorePassword.toCharArray());
            return keystore;
        } catch (KeyStoreException | CertificateException
                | NoSuchAlgorithmException | IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getKeyStore(InputStream ksStream, char[] storePass)
  2. getKeyStore(String file_name, char[] storepass)
  3. getKeyStore(String filename, char[] password)
  4. getKeyStore(String filename, String password)
  5. getKeyStore(String keyStoreName, String password)
  6. getKeyStore(String keyStorePath, String password)
  7. getKeyStore(String ksType, String file, String ksPassword)
  8. getKeyStore(String path, String passwd, String storeType)
  9. getKeyStoreFromFile(String filePath, char[] password)