Package org.jpos.security
Class SimpleKeyFile
- java.lang.Object
-
- org.jpos.security.SimpleKeyFile
-
- All Implemented Interfaces:
Configurable
,SecureKeyStore
,LogSource
public class SimpleKeyFile extends java.lang.Object implements SecureKeyStore, Configurable, LogSource
Implements SecureKeyStore using a properties file.- See Also:
Properties
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jpos.security.SecureKeyStore
SecureKeyStore.SecureKeyStoreException
-
-
Constructor Summary
Constructors Constructor Description SimpleKeyFile()
SimpleKeyFile(java.lang.String keyFileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecureKey
getKey(java.lang.String alias)
Returns the key assiciated with the given alias.java.util.Map<java.lang.String,SecureKey>
getKeys()
Returns map of existing keys assiciated with aliases.Logger
getLogger()
java.lang.String
getProperty(java.lang.String alias, java.lang.String subName)
java.lang.String
getRealm()
void
init(java.lang.String keyFileName)
void
setConfiguration(Configuration cfg)
void
setKey(java.lang.String alias, SecureKey secureKey)
Assigns the given key to the given alias.void
setLogger(Logger logger, java.lang.String realm)
void
setProperty(java.lang.String alias, java.lang.String subName, java.lang.String value)
-
-
-
Constructor Detail
-
SimpleKeyFile
public SimpleKeyFile()
-
SimpleKeyFile
public SimpleKeyFile(java.lang.String keyFileName) throws SecureKeyStore.SecureKeyStoreException
-
-
Method Detail
-
init
public void init(java.lang.String keyFileName) throws SecureKeyStore.SecureKeyStoreException
-
setConfiguration
public void setConfiguration(Configuration cfg) throws ConfigurationException
- Specified by:
setConfiguration
in interfaceConfigurable
- Parameters:
cfg
- configuration object- Throws:
ConfigurationException
-
getKey
public SecureKey getKey(java.lang.String alias) throws SecureKeyStore.SecureKeyStoreException
Description copied from interface:SecureKeyStore
Returns the key assiciated with the given alias.- Specified by:
getKey
in interfaceSecureKeyStore
- Parameters:
alias
- the alias name- Returns:
- the requested key, or
null
if the given alias does not exist. - Throws:
SecureKeyStore.SecureKeyStoreException
- if SecureKeyStore is not initialized or if the operation fails for some other reason.
-
setKey
public void setKey(java.lang.String alias, SecureKey secureKey) throws SecureKeyStore.SecureKeyStoreException
Description copied from interface:SecureKeyStore
Assigns the given key to the given alias. If the given alias already exists, the keystore information associated with it is overridden by the given key.- Specified by:
setKey
in interfaceSecureKeyStore
- Parameters:
alias
- the alias namesecureKey
- the key to be associated with the alias- Throws:
SecureKeyStore.SecureKeyStoreException
- if SecureKeyStore is not initialized or the key can't be recovered.
-
getProperty
public java.lang.String getProperty(java.lang.String alias, java.lang.String subName) throws SecureKeyStore.SecureKeyStoreException
-
setProperty
public void setProperty(java.lang.String alias, java.lang.String subName, java.lang.String value)
-
getKeys
public java.util.Map<java.lang.String,SecureKey> getKeys() throws SecureKeyStore.SecureKeyStoreException
Description copied from interface:SecureKeyStore
Returns map of existing keys assiciated with aliases.- Specified by:
getKeys
in interfaceSecureKeyStore
- Returns:
- map of existing keys assiciated with aliases.
- Throws:
SecureKeyStore.SecureKeyStoreException
- if SecureKeyStore is not initialized or if the operation fails for some other reason.
-
-