|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ContentEncryptionService
It is a security service for protecting content from an access in plain data. The service provides the encryption and the decryption of content by using a symmetric-key cryptographic algorithm for which it manages the key.
The implementation of this service must be accessible within an IoC container under the name "contentEncryptionService". This service doesn't maintain the knowledge of the contents that were encrypted; it is not of its responsibility. Therefore, when the encryption key is updated, it is the responsibility of the content management services to provide this service the encrypted contents they manage. For doing, it provides them an interface to register a content provider in the form of anEncryptionContentIterator
object. These iterators will be then used directly by the
content encryption service to renew their cipher when the key is updated.
When the encryption key is updated, all of the encryption and decryption capabilities are then
locked. If a call is performed to one of this service's methods, an IllegalStateException is
thrown.
Method Summary | |
---|---|
Map<String,String> |
decryptContent(Map<String,String> encryptedContent)
Decrypts the specified encrypted content by using the encryption key that was set with the updateCipherKey(String) method. |
String[] |
decryptContent(String... encryptedContentParts)
Decrypts the specified encrypted content by using the encryption key that was set with the updateCipherKey(String) method. |
void |
decryptContents(EncryptionContentIterator... iterators)
Decrypts the encrypted contents provided by the specified iterators. |
Map<String,String> |
encryptContent(Map<String,String> content)
Encrypts the specified content by using the encryption key that was set with the updateCipherKey(String) method. |
String[] |
encryptContent(String... contentParts)
Encrypts the specified content by using the encryption key that was set with the updateCipherKey(String) method. |
void |
encryptContents(EncryptionContentIterator... iterators)
Encrypts the contents provided by the specified iterators. |
boolean |
isCipherKeyDefined()
Checks if a key is defined and so if content can be encrypted |
void |
registerForRenewingContentCipher(EncryptionContentIterator iterator)
Registers the specified iterator on some encrypted contents for which the cipher has to be renewed when the encryption key is updated. |
void |
renewCipherOfContents(EncryptionContentIterator... iterators)
Renews explicitly the cipher of the contents provided by the specified iterators. |
void |
updateCipherKey(String key)
Updates the key to use to encrypt and to decrypt the enciphered content. |
Method Detail |
---|
String[] decryptContent(String... encryptedContentParts) throws CryptoException
updateCipherKey(String)
method.
encryptedContentParts
- either the different part of an encrypted content to decrypt or
several single encrypted textual contents to decrypt.
If the encryption key is is being updated, an IllegalStateException is thrown.
CryptoException
- the decryption of one of the encrypted content (or content part)
failed.Map<String,String> decryptContent(Map<String,String> encryptedContent) throws CryptoException
updateCipherKey(String)
method.
The encrypted content is here in the form of a Map instance in which each entry represents a
field or a property of the encrypted content. The method returns also a Map with, for each
entry, the field or the property decrypted.
If the encryption key is is being updated, an IllegalStateException is thrown.
encryptedContent
- the content to decrypt in the form of a Map instance. Each entry in the
Map represents a field/property of the content to decrypt.
CryptoException
- the decryption of the content failed.void decryptContents(EncryptionContentIterator... iterators) throws CryptoException
iterators
- the iterators on the contents to decrypt.
CryptoException
String[] encryptContent(String... contentParts) throws CryptoException
updateCipherKey(String)
method.
contentParts
- either the different part of a content to encrypt or several single textual
contents to encrypt.
If the encryption key is is being updated, an IllegalStateException is thrown.
CryptoException
- the encryption of one of the content (or content part) failed.Map<String,String> encryptContent(Map<String,String> content) throws CryptoException
updateCipherKey(String)
method.
The content is here in the form of a Map instance in which each entry represents a field or a
property of the content. The method returns also a Map with, for each entry, the field or the
property encrypted and in base64.
If the encryption key is is being updated, an IllegalStateException is thrown.
content
- the content to encrypt in the form of a Map instance. Each entry in the Map
represents a field/property of the content to encrypt.
CryptoException
- the encryption of the content failed.void encryptContents(EncryptionContentIterator... iterators) throws CryptoException
iterators
- the iterators on the contents to encrypt.
CryptoException
void registerForRenewingContentCipher(EncryptionContentIterator iterator)
iterator
- a provider of encrypted content in the form of a
EncryptionContentIterator
iterator.void renewCipherOfContents(EncryptionContentIterator... iterators) throws CipherKeyUpdateException, CryptoException
iterators
- the iterators on the encrypted contents for which their cipher has to be
renewed.
CipherKeyUpdateException
- if the replace of the cipher key has failed.
CryptoException
- if an error while renewing the cipher of the encrypted contents with
the new cipher key.void updateCipherKey(String key) throws CipherKeyUpdateException, CryptoException
CryptoException
is thrown.
The execution of this method will block any other call of the DefaultContentEncryptionService
methods for all of its instances in order to prevent incoherent state of encrypted contents.
Any attempts to execute one of the DefaultContentEncryptionService method, whereas this method
is running, will raise an IllegalStateException exception.
key
- the new symmetric key in hexadecimal.
CipherKeyUpdateException
- if the update of the cipher key has failed.
CryptoException
- if an error while renewing the cipher of the encrypted contents with
the new cipher key.boolean isCipherKeyDefined()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |