Java Key Create getKeyStore(String keyStoreName, String password)

Here you can find the source of getKeyStore(String keyStoreName, String password)

Description

get Key Store

License

Apache License

Declaration

private static KeyStore getKeyStore(String keyStoreName, String password) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.FileInputStream;
import java.io.IOException;

import java.security.KeyStore;

public class Main {
    private static KeyStore getKeyStore(String keyStoreName, String password) throws IOException {
        KeyStore ks = null;/*from w  w w.j  av a 2s .  c o  m*/
        FileInputStream fis = null;
        try {
            ks = KeyStore.getInstance("JKS");
            char[] passwordArray = password.toCharArray();
            fis = new java.io.FileInputStream(keyStoreName);
            ks.load(fis, passwordArray);
            fis.close();

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (fis != null) {
                fis.close();
            }
        }
        return ks;
    }
}

Related

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