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 Description protected org.apache.commons.logging.Log
log
-
Constructor Summary
Constructors Modifier Constructor Description protected
KeyStoreWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Key
getDefaultPrivateKey()
Returns the key based on default alias or passwordprotected Key
getKey(String alias, String keyPassword)
Returns the key based on provided alias and key passwordprotected KeyStore
getKeyStore()
Returns KeyStore Informationprotected Key
getPrivateKey(String alias)
Returns the key based on default key passwordPublicKey
getPublicKey()
Returns the public key based on initialization dataPublicKey
getPublicKey(String alias)
Returns the public key for the given aliasprotected Key
getPublicKeyFromCertificate(String alias)
Returns the key based on certificate of the owner to who given alias belongSecretKey
getSecretKey()
Returns the secret key based on initialization dataSecretKey
getSecretKey(String alias, String keyPassword)
Returns the secret keyprotected void
init(KeyStoreInformation information, String keyPassword)
Initialize the KeyStore wrapper based on provided KeyStoreInformation and passwords
-
-
-
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 passwordskeyPassword
- 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 keyStorekeyPassword
- 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 keyStorekeyPassword
- 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
-
-