public final class JmeterKeyStore extends Object
Modifier and Type | Method and Description |
---|---|
String |
getAlias()
Get the next or only alias.
|
String |
getAlias(int index) |
int |
getAliasCount() |
X509Certificate[] |
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)
|
PrivateKey |
getPrivateKey(String alias)
Return the private Key for a specific alias
|
void |
load(InputStream is,
String pword)
Process the input stream and try to read the keys from the store
|
public void load(InputStream is, String pword) throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, UnrecoverableKeyException
is
- InputStream
from which the store should be loadedpword
- the password used to check the integrity of the storeIOException
- 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)public X509Certificate[] getCertificateChain(String alias)
alias
- the alias for which the certificate chain should be givenIllegalArgumentException
- if no chain could be found for the aliaspublic String getAlias()
IllegalArgumentException
- if clientCertAliasVarName
is not empty and no key for this
alias could be foundpublic int getAliasCount()
public String getAlias(int index)
public PrivateKey getPrivateKey(String alias)
alias
- the name of the alias for the private keyalias
IllegalArgumentException
- when no private key could be foundpublic static JmeterKeyStore getInstance(String type, int startIndex, int endIndex, String clientCertAliasVarName) throws KeyStoreException
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 keyKeyStoreException
- when the type of the store is not supportedIllegalArgumentException
- when startIndex
< 0, endIndex
< 0, or endIndex
< startIndex
public static JmeterKeyStore getInstance(String type) throws KeyStoreException
type
- of the store e.g. JKSKeyStoreException
- when the type of the store is not supportedpublic String[] getClientAliases(String keyType, Principal[] issuers)
keyType
- the key algorithm type name (RSA, DSA, etc.)issuers
- the CA certificates we are narrowing our selection on.Copyright © 1998-2016 Apache Software Foundation. All Rights Reserved.