|
Cumulus4j API (1.2.0) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cumulus4j.store.crypto.AbstractCryptoManager
public abstract class AbstractCryptoManager
Abstract base-class for implementing CryptoManagers.
This class already implements a mechanism to close expired CryptoSessions
periodically (see getCryptoSessionExpiryAge() and getCryptoSessionExpiryTimerPeriod()).
| Field Summary |
|---|
| Fields inherited from interface org.cumulus4j.store.crypto.CryptoManager |
|---|
MAC_ALGORITHM_NONE, PROPERTY_CRYPTO_MANAGER_ID, PROPERTY_CRYPTO_SESSION_EXPIRY_AGE, PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_ENABLED, PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_PERIOD, PROPERTY_ENCRYPTION_ALGORITHM, PROPERTY_MAC_ALGORITHM |
| Constructor Summary | |
|---|---|
AbstractCryptoManager()
|
|
| Method Summary | |
|---|---|
protected void |
closeExpiredCryptoSessions(boolean force)
Close expired CryptoSessions. |
protected abstract CryptoSession |
createCryptoSession()
Create a new instance of a class implementing CryptoSession. |
String |
getCryptoManagerID()
Get the cryptoManagerID of this instance. |
CryptoManagerRegistry |
getCryptoManagerRegistry()
Get the registry which manages this CryptoManager. |
CryptoSession |
getCryptoSession(String cryptoSessionID)
Get the CryptoSession identified by the given cryptoSessionID. |
protected long |
getCryptoSessionExpiryAge()
Get the age after which an unused session expires. |
protected boolean |
getCryptoSessionExpiryTimerEnabled()
Get the enabled status of the timer used to cleanup. |
protected long |
getCryptoSessionExpiryTimerPeriod()
Get the period in which expired crypto sessions are searched and closed. |
String |
getEncryptionAlgorithm()
Get the value of the property "cumulus4j.encryptionAlgorithm". |
String |
getMACAlgorithm()
Get the value of the property "cumulus4j.macAlgorithm". |
void |
onCloseCryptoSession(CryptoSession cryptoSession)
Notify the CryptoManager about the fact that a session is currently being closed. |
void |
setCryptoManagerID(String cryptoManagerID)
Set the cryptoManagerID of this instance. |
void |
setCryptoManagerRegistry(CryptoManagerRegistry cryptoManagerRegistry)
Set the registry which manages this CryptoManager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractCryptoManager()
| Method Detail |
|---|
protected long getCryptoSessionExpiryTimerPeriod()
Get the period in which expired crypto sessions are searched and closed.
This value can be configured using the persistence property .
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_PERIOD,
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_ENABLEDprotected boolean getCryptoSessionExpiryTimerEnabled()
Get the enabled status of the timer used to cleanup.
This value can be configured using the persistence property .
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_ENABLED,
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_PERIODprotected long getCryptoSessionExpiryAge()
Get the age after which an unused session expires.
This value can be configured using the persistence property .
A CryptoSession expires when its lastUsageTimestamp
is longer in the past than this expiry age. Note, that the session might be kept longer, because a
timer checks periodically for expired sessions.
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_AGEprotected void closeExpiredCryptoSessions(boolean force)
Close expired CryptoSessions. If force == false, it does so only periodically.
This method is called by getCryptoSession(String) with force == false, if the timer
is disabled timer-period == 0. If the timer is enabled,
it is called periodically by the timer with force == true.
force - whether to force the cleanup now or only do it periodically.CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_AGE,
CryptoManager.PROPERTY_CRYPTO_SESSION_EXPIRY_TIMER_PERIODpublic CryptoManagerRegistry getCryptoManagerRegistry()
CryptoManagerCryptoManager.
This method should normally never return null, because
the registry is set immediately
after instantiation.
getCryptoManagerRegistry in interface CryptoManagerCryptoManager.CryptoManager.setCryptoManagerRegistry(CryptoManagerRegistry)public void setCryptoManagerRegistry(CryptoManagerRegistry cryptoManagerRegistry)
CryptoManagerCryptoManager.
This method is called by the CryptoManagerRegistry whenever
it creates a new instance of CryptoManager.
setCryptoManagerRegistry in interface CryptoManagerCryptoManager.getCryptoManagerRegistry()public String getCryptoManagerID()
CryptoManager
Get the cryptoManagerID of this instance.
The cryptoManagerID is configured in the plugin.xml when registering an extension
to the extension-point org.cumulus4j.api.cryptoManager. It is then used by the client to
specify which method of key-exchange (or key-management in general) and encryption/decryption is desired.
This is done by setting the property CryptoManager.PROPERTY_CRYPTO_MANAGER_ID.
This method is thread-safe.
getCryptoManagerID in interface CryptoManagercryptoManagerID of this instance.public void setCryptoManagerID(String cryptoManagerID)
CryptoManager
Set the cryptoManagerID of this instance.
This method is called with the value configured in the plugin.xml
directly after instantiating the CryptoManager.
You must never directly call this method! It is not an API method!
setCryptoManagerID in interface CryptoManagercryptoManagerID - the identifier to set.CryptoManager.getCryptoManagerID()protected abstract CryptoSession createCryptoSession()
Create a new instance of a class implementing CryptoSession.
This method is called by getCryptoSession(String), if it needs a new CryptoSession instance.
Implementors should simply instantiate and return their implementation of
CryptoSession. It is not necessary to call CryptoSession.setCryptoSessionID(String)
and the like here - this is automatically done afterwards by getCryptoSession(String).
CryptoSession instance.public CryptoSession getCryptoSession(String cryptoSessionID)
CryptoManager
Get the CryptoSession identified by the given cryptoSessionID.
Usually, every client opens one crypto-session. How exactly this happens, is highly dependent
on the CryptoManager and CryptoSession implementation. The
cryptoSessionID is then passed from the client to
the server which itself passes it to the PersistenceManager (or EntityManager)
via the property with the name CryptoSession.PROPERTY_CRYPTO_SESSION_ID.
Calling this method with a non-existing cryptoSessionID implicitely creates
a CryptoSession instance and returns it. A future call to this method with the same
cryptoSessionID returns the same CryptoSession instance.
A CryptoSession should only be kept in the memory of a CryptoManager for a limited time.
It is recommended to remove it
a short configurable time (e.g. 10 minutes) after the last usage.
This method must call CryptoSession.updateLastUsageTimestamp().
This method is thread-safe.
getCryptoSession in interface CryptoManagercryptoSessionID - the cryptoSessionID for which to look up or
create a CryptoSession.
CryptoSession identified by the given identifier; never null.public void onCloseCryptoSession(CryptoSession cryptoSession)
CryptoManager
Notify the CryptoManager about the fact that a session is currently being closed.
Important: This method must never be called directly! It must be called by CryptoSession.close().
onCloseCryptoSession in interface CryptoManagercryptoSession - the session that is currently closed.public String getEncryptionAlgorithm()
CryptoManager
getEncryptionAlgorithm in interface CryptoManagerCryptoManager.PROPERTY_ENCRYPTION_ALGORITHMpublic String getMACAlgorithm()
CryptoManager
getMACAlgorithm in interface CryptoManagerCryptoManager.PROPERTY_MAC_ALGORITHM
|
Cumulus4j API (1.2.0) |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||