org.apache.jmeter.rmi

## Class AliasKeyManager

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

- All Implemented Interfaces:
    javax.net.ssl.KeyManager, javax.net.ssl.X509KeyManager

      public class AliasKeyManager
      extends java.lang.Object
      implements javax.net.ssl.X509KeyManager

  Implementation of `KeyManager` that allows using an alias
  Since:
    4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AliasKeyManager(javax.net.ssl.X509KeyManager km, java.lang.String alias)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `chooseClientAlias(java.lang.String[] keyType, java.security.Principal[] issuers, java.net.Socket socket)`
    `java.lang.String` | `chooseServerAlias(java.lang.String keyType, java.security.Principal[] issuers, java.net.Socket socket)`
    `java.security.cert.X509Certificate[]` | `getCertificateChain(java.lang.String alias)`
    `java.lang.String[]` | `getClientAliases(java.lang.String keyType, java.security.Principal[] issuers)`
    `java.security.PrivateKey` | `getPrivateKey(java.lang.String alias)`
    `java.lang.String[]` | `getServerAliases(java.lang.String keyType, java.security.Principal[] issuers)`
    `static AliasKeyManager[]` | `wrap(javax.net.ssl.KeyManager[] kms, java.lang.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 Detail

    - #### AliasKeyManager

          public AliasKeyManager(javax.net.ssl.X509KeyManager km,
                                 java.lang.String alias)

  - ### Method Detail

    - #### wrap

          public static AliasKeyManager[] wrap(javax.net.ssl.KeyManager[] kms,
                                               java.lang.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:
        `java.lang.IllegalArgumentException` - if no valid KeyManager is found

    - #### chooseClientAlias

          public java.lang.String chooseClientAlias(java.lang.String[] keyType,
                                                    java.security.Principal[] issuers,
                                                    java.net.Socket socket)

      Specified by:
        `chooseClientAlias` in interface `javax.net.ssl.X509KeyManager`

    - #### chooseServerAlias

          public java.lang.String chooseServerAlias(java.lang.String keyType,
                                                    java.security.Principal[] issuers,
                                                    java.net.Socket socket)

      Specified by:
        `chooseServerAlias` in interface `javax.net.ssl.X509KeyManager`

    - #### getCertificateChain

          public java.security.cert.X509Certificate[] getCertificateChain(java.lang.String alias)

      Specified by:
        `getCertificateChain` in interface `javax.net.ssl.X509KeyManager`

    - #### getClientAliases

          public java.lang.String[] getClientAliases(java.lang.String keyType,
                                                     java.security.Principal[] issuers)

      Specified by:
        `getClientAliases` in interface `javax.net.ssl.X509KeyManager`

    - #### getPrivateKey

          public java.security.PrivateKey getPrivateKey(java.lang.String alias)

      Specified by:
        `getPrivateKey` in interface `javax.net.ssl.X509KeyManager`

    - #### getServerAliases

          public java.lang.String[] getServerAliases(java.lang.String keyType,
                                                     java.security.Principal[] issuers)

      Specified by:
        `getServerAliases` in interface `javax.net.ssl.X509KeyManager`

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.