org.apache.synapse.securevault.keystore

## Class KeyStoreWrapper

- java.lang.Object
- - org.apache.synapse.securevault.keystore.KeyStoreWrapper

- Direct Known Subclasses:
    IdentityKeyStoreWrapper, TrustKeyStoreWrapper

      public abstract class KeyStoreWrapper
      extends Object

  Wraps the keyStore and provide abstraction need for ciphering.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.commons.logging.Log` | `log`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `KeyStoreWrapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Key` | `getDefaultPrivateKey()` Returns the key based on default alias or password
    `protected Key` | `getKey(String alias, String keyPassword)` Returns the key based on provided alias and key password
    `protected KeyStore` | `getKeyStore()` Returns KeyStore Information
    `protected Key` | `getPrivateKey(String alias)` Returns the key based on default key password
    `PublicKey` | `getPublicKey()` Returns the public key based on initialization data
    `PublicKey` | `getPublicKey(String alias)` Returns the public key for the given alias
    `protected Key` | `getPublicKeyFromCertificate(String alias)` Returns the key based on certificate of the owner to who given alias belong
    `SecretKey` | `getSecretKey()` Returns the secret key based on initialization data
    `SecretKey` | `getSecretKey(String alias, String keyPassword)` Returns the secret key
    `protected void` | `init(KeyStoreInformation information, String keyPassword)` Initialize the KeyStore wrapper based on provided KeyStoreInformation and passwords

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

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

- - ### Field Detail

    - #### log

          protected org.apache.commons.logging.Log log

  - ### Constructor Detail

    - #### KeyStoreWrapper

          protected KeyStoreWrapper()

  - ### Method Detail

    - #### init

          protected void init(KeyStoreInformation information,
                              String keyPassword)

      Initialize the KeyStore wrapper based on provided KeyStoreInformation and passwords
      Parameters:
        `information` - The object that has encapsulated all information for a keyStore excepts passwords
        `keyPassword` - Specifies the password of the key within the keyStore

    - #### getKey

          protected Key getKey(String alias,
                               String keyPassword)

      Returns the key based on provided alias and key password
      Parameters:
        `alias` - The alias of the certificate in the specified keyStore
        `keyPassword` - Password for key within the KeyStrore
      Returns:
        Key if there is a one , otherwise null

    - #### getPublicKeyFromCertificate

          protected Key getPublicKeyFromCertificate(String alias)

      Returns the key based on certificate of the owner to who given alias belong
      Parameters:
        `alias` - The alias of the certificate in the specified keyStore
      Returns:
        Key , if there is a one , otherwise null

    - #### getDefaultPrivateKey

          protected Key getDefaultPrivateKey()

      Returns the key based on default alias or password
      Returns:
        Key , if there is a one , otherwise null

    - #### getPrivateKey

          protected Key getPrivateKey(String alias)

      Returns the key based on default key password
      Parameters:
        `alias` - The alias
      Returns:
        Key , if there is a one , otherwise null

    - #### getPublicKey

          public PublicKey getPublicKey(String alias)

      Returns the public key for the given alias
      Parameters:
        `alias` - The alias of the certificate in the specified keyStore
      Returns:
        PublicKey if there is a one , otherwise null

    - #### getPublicKey

          public PublicKey getPublicKey()

      Returns the public key based on initialization data
      Returns:
        PublicKey if there is a one , otherwise null

    - #### getKeyStore

          protected KeyStore getKeyStore()

      Returns KeyStore Information
      Returns:
        KeyStore Instance

    - #### getSecretKey

          public SecretKey getSecretKey(String alias,
                                        String keyPassword)

      Returns the secret key
      Parameters:
        `alias` - The alias of the certificate in the specified keyStore
        `keyPassword` - Password to access secret key
      Returns:
        SecretKey if there is a one , otherwise null

    - #### getSecretKey

          public SecretKey getSecretKey()

      Returns the secret key based on initialization data
      Returns:
        SecretKey if there is a one , otherwise null

Copyright © 2005–2019 Apache Software Foundation. All rights reserved.