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 java.lang.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 java.security.Key` | `getDefaultPrivateKey()` Returns the key based on default alias or password
    `protected java.security.Key` | `getKey(java.lang.String alias, java.lang.String keyPassword)` Returns the key based on provided alias and key password
    `protected java.security.KeyStore` | `getKeyStore()` Returns KeyStore Information
    `protected java.security.Key` | `getPrivateKey(java.lang.String alias)` Returns the key based on default key password
    `java.security.PublicKey` | `getPublicKey()` Returns the public key based on initialization data
    `java.security.PublicKey` | `getPublicKey(java.lang.String alias)` Returns the public key for the given alias
    `protected java.security.Key` | `getPublicKeyFromCertificate(java.lang.String alias)` Returns the key based on certificate of the owner to who given alias belong
    `javax.crypto.SecretKey` | `getSecretKey()` Returns the secret key based on initialization data
    `javax.crypto.SecretKey` | `getSecretKey(java.lang.String alias, java.lang.String keyPassword)` Returns the secret key
    `protected void` | `init(KeyStoreInformation information, java.lang.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,
                              java.lang.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 java.security.Key getKey(java.lang.String alias,
                                             java.lang.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 java.security.Key getPublicKeyFromCertificate(java.lang.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 java.security.Key getDefaultPrivateKey()

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

    - #### getPrivateKey

          protected java.security.Key getPrivateKey(java.lang.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 java.security.PublicKey getPublicKey(java.lang.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 java.security.PublicKey getPublicKey()

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

    - #### getKeyStore

          protected java.security.KeyStore getKeyStore()

      Returns KeyStore Information
      Returns:
        KeyStore Instance

    - #### getSecretKey

          public javax.crypto.SecretKey getSecretKey(java.lang.String alias,
                                                     java.lang.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 javax.crypto.SecretKey getSecretKey()

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

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.