public final class JmeterKeyStore
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ALIAS_VAR_NAME |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlias()
Get the next or only alias.
|
java.lang.String |
getAlias(int index) |
int |
getAliasCount() |
java.security.cert.X509Certificate[] |
getCertificateChain(java.lang.String alias)
Get the ordered certificate chain for a specific alias.
|
java.lang.String[] |
getClientAliases(java.lang.String keyType,
java.security.Principal[] issuers)
Compiles the list of all client aliases with a private key.
|
static JmeterKeyStore |
getInstance(java.lang.String type)
Create a keystore which returns the first alias only.
|
static JmeterKeyStore |
getInstance(java.lang.String type,
int startIndex,
int endIndex,
java.lang.String clientCertAliasVarName)
Create a keystore which returns a range of aliases (if available)
|
java.security.PrivateKey |
getPrivateKey(java.lang.String alias)
Return the private Key for a specific alias
|
void |
load(java.io.InputStream is,
java.lang.String pword)
Process the input stream and try to read the keys from the store
|
public static final java.lang.String DEFAULT_ALIAS_VAR_NAME
public void load(java.io.InputStream is, java.lang.String pword) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.io.IOException, java.security.KeyStoreException, java.security.UnrecoverableKeyException
is
- InputStream
from which the store should be loadedpword
- the password used to check the integrity of the storejava.io.IOException
- if there is a problem decoding or reading the store. A bad
password might be the cause for this, or an empty storejava.security.cert.CertificateException
- if any of the certificated in the store can not be loadedjava.security.NoSuchAlgorithmException
- if the algorithm to check the integrity of the store can not
be foundjava.security.KeyStoreException
- if the store has not been initialized (should not happen
here)java.security.UnrecoverableKeyException
- if the key can not be recovered from the store (should not
happen here, either)public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias)
alias
- the alias for which the certificate chain should be givenjava.lang.IllegalArgumentException
- if no chain could be found for the aliaspublic java.lang.String getAlias()
java.lang.IllegalArgumentException
- if clientCertAliasVarName
is not empty and no key for this
alias could be foundpublic int getAliasCount()
public java.lang.String getAlias(int index)
public java.security.PrivateKey getPrivateKey(java.lang.String alias)
alias
- the name of the alias for the private keyalias
java.lang.IllegalArgumentException
- when no private key could be foundpublic static JmeterKeyStore getInstance(java.lang.String type, int startIndex, int endIndex, java.lang.String clientCertAliasVarName) throws java.security.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 keyjava.security.KeyStoreException
- when the type of the store is not supportedjava.lang.IllegalArgumentException
- when startIndex
< 0, endIndex
< 0, or endIndex
< startIndex
public static JmeterKeyStore getInstance(java.lang.String type) throws java.security.KeyStoreException
type
- of the store e.g. JKSjava.security.KeyStoreException
- when the type of the store is not supportedpublic java.lang.String[] getClientAliases(java.lang.String keyType, java.security.Principal[] issuers)
keyType
- the key algorithm type name (RSA, DSA, etc.)issuers
- the CA certificates we are narrowing our selection on.Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.