|
Cumulus4j API (1.2.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cumulus4j.store.crypto.AbstractCryptoSession org.cumulus4j.store.crypto.keymanager.KeyManagerCryptoSession
public class KeyManagerCryptoSession
Implementation of CryptoSession
working with a
key-manager as shown in Deployment scenarios.
Field Summary |
---|
Fields inherited from interface org.cumulus4j.store.crypto.CryptoSession |
---|
PROPERTY_CRYPTO_SESSION_ID |
Constructor Summary | |
---|---|
KeyManagerCryptoSession()
|
Method Summary | |
---|---|
void |
close()
Close the session. |
Plaintext |
decrypt(CryptoContext cryptoContext,
Ciphertext ciphertext)
Decrypt the given ciphertext. |
Ciphertext |
encrypt(CryptoContext cryptoContext,
Plaintext plaintext)
Encrypt the given plaintext. |
Methods inherited from class org.cumulus4j.store.crypto.AbstractCryptoSession |
---|
assertNotClosed, getCreationTimestamp, getCryptoManager, getCryptoSessionID, getKeyStoreID, getLastUsageTimestamp, isClosed, setCryptoManager, setCryptoSessionID, updateLastUsageTimestamp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyManagerCryptoSession()
Method Detail |
---|
public Ciphertext encrypt(CryptoContext cryptoContext, Plaintext plaintext)
Encrypt the given plaintext.
This method is thread-safe. Thus, implementors should keep in mind that Cipher
is not thread-safe!
The implementation in KeyManagerCryptoSession
stores every plaintext
encoded in the following form:
Bytes | Description | ||||||||||||
1 | Version number | ||||||||||||
2 | EncryptionCoordinateSet.getEncryptionCoordinateSetID() (only 2 bytes, thus limiting to 65K possible values) |
||||||||||||
1 | ivLen: Length of the IV in bytes | ||||||||||||
ivLen | Actual IV (random initialisation vector). | ||||||||||||
1 | macKeyLen: MAC's key length in bytes | ||||||||||||
1 | macIVLen: MAC's IV length in bytes | ||||||||||||
1 | macLen: Actual MAC's length in bytes | ||||||||||||
|
cryptoContext
- context used to encrypt or decrypt data.plaintext
- the unencrypted information (aka plaintext) to be encrypted.
public Plaintext decrypt(CryptoContext cryptoContext, Ciphertext ciphertext)
CryptoSession
Decrypt the given ciphertext.
This method is thread-safe. Thus, implementors should keep in mind that Cipher
is not thread-safe!
cryptoContext
- context used to encrypt or decrypt data.ciphertext
- the encrypted information (aka ciphertext) to be decrypted.
public void close()
AbstractCryptoSession
Close the session.
After closing, the CryptoSession
cannot be used for encryption/decryption anymore, i.e.
CryptoSession.encrypt(CryptoContext, Plaintext)
and CryptoSession.decrypt(CryptoContext, Ciphertext)
very likely throw an exception. The other
methods might still work.
This method can be called multiple times - every following call will be silently ignored.
When overriding this method, you should first call super.close();
and
then perform your own closing operations.
close
in interface CryptoSession
close
in class AbstractCryptoSession
|
Cumulus4j API (1.2.0) |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |