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) |
PrivateKey |
readPrivateKeyFromKeyStore(String alias,
String password) |
PublicKey |
readPublicKeyFromKeyStore(String alias) |
SecretKey |
readSecretKeyFromKeyStore(String alias) |
SecretKey |
readSecretKeyFromKeyStore(String alias,
String password) |
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
SecureStorageException
public PrivateKey readPrivateKeyFromKeyStore(String alias) throws SecureStorageException
SecureStorageException
public PrivateKey readPrivateKeyFromKeyStore(String alias, String password) throws SecureStorageException
SecureStorageException
public SecretKey readSecretKeyFromKeyStore(String alias) throws SecureStorageException
SecureStorageException
public SecretKey readSecretKeyFromKeyStore(String alias, String password) throws SecureStorageException
SecureStorageException
public KeyStore getStore()
KeyStoreHandler
getStore
in interface KeyStoreHandler
public void setStore(KeyStore keystore) throws Exception
KeyStoreHandler
setStore
in interface KeyStoreHandler
keystore
- The keystore to useException
- If an error occurspublic String getPassword()
KeyStoreHandler
getPassword
in interface KeyStoreHandler
public String getLocation()
KeyStoreHandler
getLocation
in interface KeyStoreHandler
public String getType()
KeyStoreHandler
getType
in interface KeyStoreHandler
public void store() throws Exception
KeyStoreHandler
store
in interface KeyStoreHandler
Exception
- If an error occurs.Copyright 2011-2015 ForgeRock AS.