Interface SecDispatcher
- All Known Implementing Classes:
DefaultSecDispatcher
public interface SecDispatcher
This component decrypts a string, passed to it using various dispatchers.
- Author:
- Oleg Gusakov
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
The validation response. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the set of available dispatcher metadata, nevernull
.Decrypt given encrypted string.Encrypt given plaintext string.default boolean
Returnstrue
if passed in string adheres to "encrypted string" format (current or legacy).boolean
isEncryptedString
(String str) Returnstrue
if passed in string adheres "encrypted string" format.boolean
Returnstrue
if passed in string adheres to "legacy encrypted string" format.readConfiguration
(boolean createIfMissing) Reads the effective configuration, eventually creating new instance if not present.Performs a "deep validation" and reports the status.void
writeConfiguration
(SettingsSecurity configuration) Writes the effective configuration.
-
Field Details
-
DISPATCHER_NAME_ATTR
Attribute that selects a dispatcher. If not present inencrypt(String, Map)
attributes, the configured "default dispatcher" is used.- See Also:
-
DISPATCHER_VERSION_ATTR
Attribute for version, added by SecDispatcher for possible upgrade path.- See Also:
-
-
Method Details
-
availableDispatchers
Set<DispatcherMeta> availableDispatchers()Returns the set of available dispatcher metadata, nevernull
. -
encrypt
Encrypt given plaintext string.- Parameters:
str
- the plaintext to encryptattr
- the attributes, may benull
- Returns:
- encrypted string
- Throws:
SecDispatcherException
- in case of problemIOException
-
decrypt
Decrypt given encrypted string.- Parameters:
str
- the encrypted string- Returns:
- decrypted string
- Throws:
SecDispatcherException
- in case of problemIOException
-
isAnyEncryptedString
Returnstrue
if passed in string adheres to "encrypted string" format (current or legacy).- Since:
- 4.0.1
-
isEncryptedString
Returnstrue
if passed in string adheres "encrypted string" format. -
isLegacyEncryptedString
Returnstrue
if passed in string adheres to "legacy encrypted string" format. -
readConfiguration
Reads the effective configuration, eventually creating new instance if not present.- Parameters:
createIfMissing
- Iftrue
, it will create a new empty instance- Returns:
- the configuration, of
null
if it does not exist increateIfMissing
isfalse
- Throws:
IOException
- In case of IO problem
-
writeConfiguration
Writes the effective configuration.- Parameters:
configuration
- The configuration to write, may not benull
- Throws:
IOException
- In case of IO problem
-
validateConfiguration
SecDispatcher.ValidationResponse validateConfiguration()Performs a "deep validation" and reports the status. If return instanceSecDispatcher.ValidationResponse.isValid()
istrue
, configuration is usable.
-