public class KeyStoreHandlerDecorator extends Object implements KeyStoreHandler
KeyStoreHandler in order to add some commons utility methods to read or write keystore's entries.| Constructor and Description |
|---|
KeyStoreHandlerDecorator(KeyStoreHandler delegate)
Constructs a new KeyStoreHandlerDecorator.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getLocation()
Returns the path to the keystore.
|
String |
getPassword()
Returns the password.
|
KeyStore |
getStore()
Get the keystore.
|
String |
getType()
Returns the type of the keystore.
|
PrivateKey |
readPrivateKeyFromKeyStore(String alias)
Get a private key for the alias using the default password from
getPassword(). |
PrivateKey |
readPrivateKeyFromKeyStore(String alias,
String password)
Get the private key with the given alias.
|
PublicKey |
readPublicKeyFromKeyStore(String alias)
Get the public key with the given alias.
|
SecretKey |
readSecretKeyFromKeyStore(String alias)
Get the secret key with the given alias using the default password from
getPassword(). |
SecretKey |
readSecretKeyFromKeyStore(String alias,
String password)
Get the secret key with the given alias.
|
void |
setStore(KeyStore keystore)
Sets the keystore.
|
void |
store()
Saves the keystore.
|
void |
writeToKeyStore(SecretKey secretKey,
String alias)
Writes to the secret storage using the same password than the KeyStoreHandler.
|
void |
writeToKeyStore(SecretKey secretKey,
String alias,
String password)
Writes to the secret storage.
|
public KeyStoreHandlerDecorator(KeyStoreHandler delegate)
delegate - the KeyStoreHandler to decorate.public void writeToKeyStore(SecretKey secretKey, String alias) throws SecureStorageException
secretKey - The data to be written to the secret storagealias - The kind of cryptoMaterial, whether it is a signature or a keySecureStorageException - if it fails to write secret data from secret storepublic void writeToKeyStore(SecretKey secretKey, String alias, String password) throws SecureStorageException
secretKey - The data to be written to the secret storagealias - The kind of cryptoMaterial, whether it is a signature or a keypassword - The password to read the keySecureStorageException - if it fails to write secret data from secret storepublic PublicKey readPublicKeyFromKeyStore(String alias) throws SecureStorageException
alias - The alias.SecureStorageException - If the key could not be read.public PrivateKey readPrivateKeyFromKeyStore(String alias) throws SecureStorageException
getPassword().alias - The alias.SecureStorageException - If the key could not be read.public PrivateKey readPrivateKeyFromKeyStore(String alias, String password) throws SecureStorageException
alias - The alias.password - The password to use to access the keystore.SecureStorageException - If the key could not be read.public SecretKey readSecretKeyFromKeyStore(String alias) throws SecureStorageException
getPassword().alias - The alias.SecureStorageException - If the key could not be read.public SecretKey readSecretKeyFromKeyStore(String alias, String password) throws SecureStorageException
alias - The alias.password - The password to use to access the keystore.SecureStorageException - If the key could not be read.public KeyStore getStore()
KeyStoreHandlergetStore in interface KeyStoreHandlerpublic void setStore(KeyStore keystore) throws Exception
KeyStoreHandlersetStore in interface KeyStoreHandlerkeystore - The keystore to useException - If an error occurspublic String getPassword()
KeyStoreHandlergetPassword in interface KeyStoreHandlerpublic String getLocation()
KeyStoreHandlergetLocation in interface KeyStoreHandlerpublic String getType()
KeyStoreHandlergetType in interface KeyStoreHandlerpublic void store()
throws Exception
KeyStoreHandlerstore in interface KeyStoreHandlerException - If an error occurs.Copyright © 2025 Open Identity Platform Community. All rights reserved.