1 18 19 package org.apache.jmeter.util.keystore; 20 21 import java.io.InputStream ; 22 import java.lang.reflect.Constructor ; 23 import java.security.PrivateKey ; 24 import java.security.cert.X509Certificate ; 25 26 32 public abstract class JmeterKeyStore 33 { 34 35 38 public abstract void load(InputStream is, String password) throws Exception ; 39 40 43 public abstract X509Certificate [] getCertificateChain(); 44 45 public abstract String getAlias(); 46 47 50 public abstract PrivateKey getPrivateKey(); 51 52 public static final JmeterKeyStore getInstance(String type) throws Exception 53 { 54 if ("PKCS12".equalsIgnoreCase(type)) 55 { 56 try 57 { 58 Class PKCS12 = 59 Class.forName( 60 "org.apache.jmeter.util.keystore.PKCS12KeyStore"); 61 Constructor con = 62 PKCS12.getConstructor(new Class [] { String .class }); 63 return (JmeterKeyStore) con.newInstance(new Object [] { type }); 64 } 65 catch (Exception e) 66 {} 67 } 68 69 Class keyStore = 70 Class.forName("org.apache.jmeter.util.keystore.DefaultKeyStore"); 71 Constructor con = keyStore.getConstructor(new Class [] { String .class }); 72 return (JmeterKeyStore) con.newInstance(new Object [] { type }); 73 } 74 } | Popular Tags |