Package org.apache.jmeter.rmi

# Class AliasKeyManager

java.lang.Object
org.apache.jmeter.rmi.AliasKeyManager

All Implemented Interfaces:
  `KeyManager`, `X509KeyManager`

public class AliasKeyManager extends Object implements X509KeyManager
Implementation of `KeyManager` that allows using an alias

Since:
  4.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AliasKeyManager(X509KeyManager km, String alias)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)`
  `String`
  `chooseServerAlias(String keyType, Principal[] issuers, Socket socket)`
  `X509Certificate[]`
  `getCertificateChain(String alias)`
  `String[]`
  `getClientAliases(String keyType, Principal[] issuers)`
  `PrivateKey`
  `getPrivateKey(String alias)`
  `String[]`
  `getServerAliases(String keyType, Principal[] issuers)`
  `static AliasKeyManager[]`
  `wrap(KeyManager[] kms, String alias)`
  Wraps the first found `X509KeyManager` that has a private key for the given `alias` as an `AliasKeyManager` and returns it as the only element in a newly created array.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AliasKeyManager

    public AliasKeyManager(X509KeyManager km, String alias)

- ## Method Details

  - ### wrap

    public static AliasKeyManager[] wrap(KeyManager[] kms, String alias)
    Wraps the first found `X509KeyManager` that has a private key for the given `alias` as an `AliasKeyManager` and returns it as the only element in a newly created array.
    Parameters:
      `kms` - the KeyManagers to be searched for the `alias`
      `alias` - the name to be searched for
    Returns:
      an array with one `AliasKeyManager` that has a private key named `alias`
    Throws:
      `IllegalArgumentException` - if no valid KeyManager is found

  - ### chooseClientAlias

    public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)
    Specified by:
      `chooseClientAlias` in interface `X509KeyManager`

  - ### chooseServerAlias

    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket)
    Specified by:
      `chooseServerAlias` in interface `X509KeyManager`

  - ### getCertificateChain

    public X509Certificate[] getCertificateChain(String alias)
    Specified by:
      `getCertificateChain` in interface `X509KeyManager`

  - ### getClientAliases

    public String[] getClientAliases(String keyType, Principal[] issuers)
    Specified by:
      `getClientAliases` in interface `X509KeyManager`

  - ### getPrivateKey

    public PrivateKey getPrivateKey(String alias)
    Specified by:
      `getPrivateKey` in interface `X509KeyManager`

  - ### getServerAliases

    public String[] getServerAliases(String keyType, Principal[] issuers)
    Specified by:
      `getServerAliases` in interface `X509KeyManager`