|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.silverpeas.util.security.DefaultContentEncryptionService
@Named(value="contentEncryptionService") public class DefaultContentEncryptionService
It is the default implementation of the ContentEncryptionService
interface in Silverpeas.
ConcurrentEncryptionTaskExecutor
class to ensure the execution of the different methods
are done by following the concurrency policy expected by the ContentEncryptionService
interface, and the CryptographicTask
class to represent a encryption or a decryption of
contents provided by some content iterators (they implement the EncryptionContentIterator
interface).
Constructor Summary | |
---|---|
protected |
DefaultContentEncryptionService()
|
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. |
protected static Map<String,String> |
decryptContent(Map<String,String> encryptedContent,
Cipher cipher,
CipherKey key)
Decrypts the specified content by using the specified cipher with the specified cipher key. |
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. |
protected static Map<String,String> |
encryptContent(Map<String,String> content,
Cipher cipher,
CipherKey key)
Encrypts the specified content by using the specified cipher with the specified cipher key. |
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. |
protected static CipherKey |
getActualCipherKey()
Gets the actual cipher key to use in the content encryption/decryption. |
protected static Cipher |
getCipherForContentEncryption()
Gets the cipher to use to encrypt/decrypt a content. |
protected static CipherKey |
getPreviousCipherKey()
Gets the previous cipher key that was used in the content encryption/decryption. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DefaultContentEncryptionService()
Method Detail |
---|
public void registerForRenewingContentCipher(EncryptionContentIterator iterator)
registerForRenewingContentCipher
in interface ContentEncryptionService
iterator
- a provider of encrypted content in the form of a
EncryptionContentIterator
iterator.public void updateCipherKey(String key) throws CipherKeyUpdateException, CryptoException
updateCipherKey
in interface ContentEncryptionService
key
- the new symmetric key in hexadecimal.
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.public String[] encryptContent(String... contentParts) throws CryptoException
updateCipherKey(String)
method.
encryptContent
in interface ContentEncryptionService
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.public 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.
encryptContent
in interface ContentEncryptionService
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.public void encryptContents(EncryptionContentIterator... iterators) throws CryptoException
encryptContents
in interface ContentEncryptionService
iterators
- the iterators on the contents to encrypt.
CryptoException
public String[] decryptContent(String... encryptedContentParts) throws CryptoException
updateCipherKey(String)
method.
decryptContent
in interface ContentEncryptionService
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.public 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.
decryptContent
in interface ContentEncryptionService
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.public void decryptContents(EncryptionContentIterator... iterators) throws CryptoException
decryptContents
in interface ContentEncryptionService
iterators
- the iterators on the contents to decrypt.
CryptoException
public void renewCipherOfContents(EncryptionContentIterator... iterators) throws CryptoException
renewCipherOfContents
in interface ContentEncryptionService
iterators
- the iterators on the encrypted contents for which their cipher has to be
renewed.
CryptoException
- if an error occurs while renewing the cipher of the contents with the
actual encryption key.protected static Map<String,String> encryptContent(Map<String,String> content, Cipher cipher, CipherKey key) throws CryptoException
content
- the content to encrypt in the form of a Map
in which each entry is a
property or a field of the content.cipher
- the cipher to encrypt the content.key
- the cipher key.
CryptoException
- if an error occurs while encrypting the content.protected static Map<String,String> decryptContent(Map<String,String> encryptedContent, Cipher cipher, CipherKey key) throws CryptoException
encryptedContent
- the encrypted content to decrypt in the form of a Map
in which
each entry is a property or a field of the content.cipher
- the cipher to decrypt the content.key
- the cipher key.
CryptoException
- if an error occurs while decrypting the content.protected static CipherKey getActualCipherKey() throws CryptoException
CryptoException
- if the cipher key cannot be get.protected static CipherKey getPreviousCipherKey() throws CryptoException
CryptoException
- if the cipher key cannot be get.protected static Cipher getCipherForContentEncryption()
public boolean isCipherKeyDefined()
ContentEncryptionService
isCipherKeyDefined
in interface ContentEncryptionService
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |