Here you can find the source of getKeyStore(String file_name, char[] storepass)
Parameter | Description |
---|---|
file_name | - a keystore file name to be loaded |
storepass | - the password for managing the keystore |
public static KeyStore getKeyStore(String file_name, char[] storepass) throws java.io.IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException
//package com.java2s; /*/*from ww w . j av a 2 s . c o m*/ * JacORB - a free Java ORB * * Copyright (C) 2000 Gerald Brose. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ import java.security.*; import java.security.cert.*; import java.io.*; public class Main { /** * @returns - a fully loaded and operational KeyStore * @param file_name - a keystore file name to be loaded * @param storepass - the password for managing the keystore */ public static KeyStore getKeyStore(String file_name, char[] storepass) throws java.io.IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException { FileInputStream in = new FileInputStream(file_name); KeyStore ks; // ks = KeyStore.getInstance("jks"); try { ks = KeyStore.getInstance("IAIKKeyStore", "IAIK"); } catch (java.security.NoSuchProviderException ex) { System.err.println(ex.toString()); ks = KeyStore.getInstance("jks"); } ks.load(in, storepass); in.close(); return ks; } }