Package org.apache.jmeter.util.keystore
Class JmeterKeyStore
java.lang.Object
org.apache.jmeter.util.keystore.JmeterKeyStore
Use this Keystore for JMeter specific KeyStores.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAlias()
Get the next or only alias.getAlias
(int index) int
getCertificateChain
(String alias) Get the ordered certificate chain for a specific alias.String[]
getClientAliases
(String keyType, Principal[] issuers) Compiles the list of all client aliases with a private key.static JmeterKeyStore
getInstance
(String type) Create a keystore which returns the first alias only.static JmeterKeyStore
getInstance
(String type, int startIndex, int endIndex, String clientCertAliasVarName) Create a keystore which returns a range of aliases (if available)getPrivateKey
(String alias) Return the private Key for a specific aliasvoid
load
(InputStream is, String pword) Process the input stream and try to read the keys from the store
-
Field Details
-
DEFAULT_ALIAS_VAR_NAME
- See Also:
-
-
Method Details
-
load
public void load(InputStream is, String pword) throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, UnrecoverableKeyException Process the input stream and try to read the keys from the store- Parameters:
is
-InputStream
from which the store should be loadedpword
- the password used to check the integrity of the store- Throws:
IOException
- if there is a problem decoding or reading the store. A bad password might be the cause for this, or an empty storeCertificateException
- if any of the certificated in the store can not be loadedNoSuchAlgorithmException
- if the algorithm to check the integrity of the store can not be foundKeyStoreException
- if the store has not been initialized (should not happen here)UnrecoverableKeyException
- if the key can not be recovered from the store (should not happen here, either)
-
getCertificateChain
Get the ordered certificate chain for a specific alias.- Parameters:
alias
- the alias for which the certificate chain should be given- Returns:
- the certificate chain for the alias or null if not found
- See Also:
-
getAlias
Get the next or only alias.- Returns:
- the next or only alias.
- Throws:
IllegalArgumentException
- ifclientCertAliasVarName
is not empty and no key for this alias could be found
-
getAliasCount
public int getAliasCount() -
getAlias
-
getPrivateKey
Return the private Key for a specific alias- Parameters:
alias
- the name of the alias for the private key- Returns:
- the private key for the given
alias
- Throws:
IllegalArgumentException
- when no private key could be found
-
getInstance
public static JmeterKeyStore getInstance(String type, int startIndex, int endIndex, String clientCertAliasVarName) throws KeyStoreException Create a keystore which returns a range of aliases (if available)- Parameters:
type
- store type (e.g. JKS)startIndex
- first index (from 0)endIndex
- last index (to count-1)clientCertAliasVarName
- name of the default key to, if empty the first key will be used as default key- Returns:
- the keystore
- Throws:
KeyStoreException
- when the type of the store is not supportedIllegalArgumentException
- whenstartIndex
< 0,endIndex
< -1, orendIndex
<startIndex
-
getInstance
Create a keystore which returns the first alias only.- Parameters:
type
- of the store e.g. JKS- Returns:
- the keystore
- Throws:
KeyStoreException
- when the type of the store is not supported
-
getClientAliases
Compiles the list of all client aliases with a private key. TODO Currently, keyType and issuers are both ignored.- Parameters:
keyType
- the key algorithm type name (RSA, DSA, etc.)issuers
- the CA certificates we are narrowing our selection on.- Returns:
- the array of aliases; null if none.
- See Also:
-