org.jpos.security
Class SimpleKeyFile

java.lang.Object
  extended by org.jpos.security.SimpleKeyFile
All Implemented Interfaces:
Configurable, SecureKeyStore, LogSource

public class SimpleKeyFile
extends Object
implements SecureKeyStore, Configurable, LogSource

Implements SecureKeyStore using a properties file.

Version:
$Revision$ $Date$
Author:
Hani S. Kirollos
See Also:
Properties

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jpos.security.SecureKeyStore
SecureKeyStore.SecureKeyStoreException
 
Field Summary
protected  Logger logger
           
protected  String realm
           
 
Constructor Summary
SimpleKeyFile()
           
SimpleKeyFile(String keyFileName)
           
 
Method Summary
 SecureKey getKey(String alias)
          returns the key assiciated with the given alias
 Map<String,SecureKey> getKeys()
          return map of existing keys assiciated with aliases.
 Logger getLogger()
           
 String getProperty(String alias, String subName)
           
 String getRealm()
           
 void init(String keyFileName)
           
 void setConfiguration(Configuration cfg)
           
 void setKey(String alias, SecureKey secureKey)
          Assigns the given key to the given alias.
 void setLogger(Logger logger, String realm)
           
 void setProperty(String alias, String subName, String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger

realm

protected String realm
Constructor Detail

SimpleKeyFile

public SimpleKeyFile()

SimpleKeyFile

public SimpleKeyFile(String keyFileName)
              throws SecureKeyStore.SecureKeyStoreException
Throws:
SecureKeyStore.SecureKeyStoreException
Method Detail

init

public void init(String keyFileName)
          throws SecureKeyStore.SecureKeyStoreException
Throws:
SecureKeyStore.SecureKeyStoreException

setLogger

public void setLogger(Logger logger,
                      String realm)
Specified by:
setLogger in interface LogSource

getLogger

public Logger getLogger()
Specified by:
getLogger in interface LogSource

getRealm

public String getRealm()
Specified by:
getRealm in interface LogSource

setConfiguration

public void setConfiguration(Configuration cfg)
                      throws ConfigurationException
Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - configuration object
Throws:
ConfigurationException

getKey

public SecureKey getKey(String alias)
                 throws SecureKeyStore.SecureKeyStoreException
Description copied from interface: SecureKeyStore
returns the key assiciated with the given alias

Specified by:
getKey in interface SecureKeyStore
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(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 interface SecureKeyStore
Parameters:
alias - the alias name
secureKey - 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 String getProperty(String alias,
                          String subName)
                   throws SecureKeyStore.SecureKeyStoreException
Throws:
SecureKeyStore.SecureKeyStoreException

setProperty

public void setProperty(String alias,
                        String subName,
                        String value)

getKeys

public Map<String,SecureKey> getKeys()
                              throws SecureKeyStore.SecureKeyStoreException
Description copied from interface: SecureKeyStore
return map of existing keys assiciated with aliases.

Specified by:
getKeys in interface SecureKeyStore
Returns:
map of existing keys assiciated with aliases.
Throws:
SecureKeyStore.SecureKeyStoreException


Copyright © 1998-2012 jPOS.org. All Rights Reserved.