⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 keystorehelper.java

📁 一个免费的CA,基于EJB平台的,老师叫我们测试,现把之共享出来让大家参考
💻 JAVA
字号:
package org.ejbca.core.protocol.ws.common;import java.io.ByteArrayInputStream;import java.io.IOException;import java.security.KeyStoreException;import java.security.NoSuchAlgorithmException;import java.security.NoSuchProviderException;import java.security.cert.CertificateException;import org.ejbca.util.Base64;/** * Class used to generate a java.security.KeyStore from a  * org.ejbca.core.protocol.ws.common.KeyStore *  * @author Philip Vendil * * $id$ */public class KeyStoreHelper {	/**	 * Retrieves the keystore from the encoded data.	 * @param type "PKCS12" or "JKS"	 * @param password to lock the keystore	 * @return the loaded and unlocked keystore.	 * @throws CertificateException	 * @throws IOException 	 * @throws NoSuchAlgorithmException 	 * @throws NoSuchProviderException 	 * @throws KeyStoreException 	 */	public static java.security.KeyStore getKeyStore(byte[] keystoreData, String type, String password) throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException, NoSuchProviderException{		java.security.KeyStore ks = java.security.KeyStore.getInstance(type, "BC");		ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decode(keystoreData));		ks.load(bais, password.toCharArray());        return ks; 	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -