Cumulus4j API
(1.0.1)

org.cumulus4j.store
Class EncryptionHandler

java.lang.Object
  extended by org.cumulus4j.store.EncryptionHandler

public class EncryptionHandler
extends Object

Singleton per PersistenceManagerFactory handling the encryption and decryption and thus the key management.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Field Summary
static boolean DEBUG_DUMP
          Dump all plain texts to the system temp directory for debug reasons.
static ThreadLocal<String> debugDumpFileNameThreadLocal
           
 
Constructor Summary
EncryptionHandler()
           
 
Method Summary
 ObjectContainer decryptDataEntry(CryptoContext cryptoContext, DataEntry dataEntry)
          Get a plain (unencrypted) ObjectContainer from the encrypted byte-array in the DataEntry.value property.
 IndexValue decryptIndexEntry(CryptoContext cryptoContext, IndexEntry indexEntry)
          Get a plain (unencrypted) IndexValue from the encrypted byte-array in the IndexEntry.indexValue property.
 void encryptDataEntry(CryptoContext cryptoContext, DataEntry dataEntry, ObjectContainer objectContainer)
          Encrypt the given plain objectContainer and store the cipher-text into the given dataEntry.
 void encryptIndexEntry(CryptoContext cryptoContext, IndexEntry indexEntry, IndexValue indexValue)
          Encrypt the given plain indexValue and store the cipher-text into the given indexEntry.
static File getDebugDumpDir()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_DUMP

public static final boolean DEBUG_DUMP
Dump all plain texts to the system temp directory for debug reasons. Should always be false in productive environments!

See Also:
Constant Field Values

debugDumpFileNameThreadLocal

public static ThreadLocal<String> debugDumpFileNameThreadLocal
Constructor Detail

EncryptionHandler

public EncryptionHandler()
Method Detail

getDebugDumpDir

public static File getDebugDumpDir()

decryptDataEntry

public ObjectContainer decryptDataEntry(CryptoContext cryptoContext,
                                        DataEntry dataEntry)
Get a plain (unencrypted) ObjectContainer from the encrypted byte-array in the DataEntry.value property.

Parameters:
cryptoContext - the context.
dataEntry - the DataEntry holding the encrypted data (read from).
Returns:
the plain ObjectContainer.
See Also:
encryptDataEntry(CryptoContext, DataEntry, ObjectContainer)

encryptDataEntry

public void encryptDataEntry(CryptoContext cryptoContext,
                             DataEntry dataEntry,
                             ObjectContainer objectContainer)
Encrypt the given plain objectContainer and store the cipher-text into the given dataEntry.

Parameters:
cryptoContext - the context.
dataEntry - the DataEntry that should be holding the encrypted data (written into).
objectContainer - the plain ObjectContainer (read from).
See Also:
decryptDataEntry(CryptoContext, DataEntry)

decryptIndexEntry

public IndexValue decryptIndexEntry(CryptoContext cryptoContext,
                                    IndexEntry indexEntry)
Get a plain (unencrypted) IndexValue from the encrypted byte-array in the IndexEntry.indexValue property.

Parameters:
cryptoContext - the context.
indexEntry - the IndexEntry holding the encrypted data (read from).
Returns:
the plain IndexValue.

encryptIndexEntry

public void encryptIndexEntry(CryptoContext cryptoContext,
                              IndexEntry indexEntry,
                              IndexValue indexValue)
Encrypt the given plain indexValue and store the cipher-text into the given indexEntry.

Parameters:
cryptoContext - the context.
indexEntry - the IndexEntry that should be holding the encrypted data (written into).
indexValue - the plain IndexValue (read from).

Cumulus4j API
(1.0.1)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.