1 package org.ejbca.core.protocol.ws.common; 2 3 import java.io.ByteArrayInputStream ; 4 import java.io.IOException ; 5 import java.security.KeyStoreException ; 6 import java.security.NoSuchAlgorithmException ; 7 import java.security.NoSuchProviderException ; 8 import java.security.cert.CertificateException ; 9 10 import org.ejbca.util.Base64; 11 12 13 21 22 public class KeyStoreHelper { 23 24 35 public static java.security.KeyStore getKeyStore(byte[] keystoreData, String type, String password) throws CertificateException , NoSuchAlgorithmException , IOException , KeyStoreException , NoSuchProviderException { 36 java.security.KeyStore ks = java.security.KeyStore.getInstance(type, "BC"); 37 ByteArrayInputStream bais = new ByteArrayInputStream (Base64.decode(keystoreData)); 38 ks.load(bais, password.toCharArray()); 39 return ks; 40 } 41 } 42 | Popular Tags |