- java.lang.Object
-
- com.pervasive.datarush.encryption.EncryptionManager
-
public final class EncryptionManager extends Object
A manager of EncryptionProvider's. Within a JVM, there is a single, staticcurrentEncryptor
that is used when performing encryption of sensitive information. ThecurrentEncryptor
may be globally set by setting thecurrentEncryptorId
. Within a JVM, there can be multipleproviders
that are used when performing decryption. This model allows for the encryption strategy to evolve over time while always being able to read files written by previous EncryptionProvider's.- See Also:
EncryptionProvider
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EncryptionProvider
getCurrentEncryptor()
Returns the encryptor to use when encrypting.String
getCurrentEncryptorId()
Gets the id of theEncryptionProvider
to use when encrypting.static EncryptionManager
getInstance()
Returns the single instance of this class.EncryptionProvider
getProvider(String id)
Returns the provider whoseproviderID
matches that given.void
setCurrentEncryptorId(String id)
Sets the id of theEncryptionProvider
to use when encrypting.
-
-
-
Method Detail
-
getInstance
public static EncryptionManager getInstance()
Returns the single instance of this class.- Returns:
- the single instance of this class
-
getProvider
public EncryptionProvider getProvider(String id)
Returns the provider whoseproviderID
matches that given.- Parameters:
id
- the providerID- Returns:
- the matching provider
- Throws:
IllegalArgumentException
- if no provider was found that matches the given ID
-
setCurrentEncryptorId
public void setCurrentEncryptorId(String id)
Sets the id of theEncryptionProvider
to use when encrypting. By default this is set toDefaultEncryptionProvider.ID
.- Parameters:
id
- the encryptor id- Throws:
IllegalArgumentException
- if the given provider is not registered
-
getCurrentEncryptorId
public String getCurrentEncryptorId()
Gets the id of theEncryptionProvider
to use when encrypting. By default this is set toDefaultEncryptionProvider.ID
.- Returns:
- the encryptor id
-
getCurrentEncryptor
public EncryptionProvider getCurrentEncryptor()
Returns the encryptor to use when encrypting. By default this is aDefaultEncryptionProvider
.- Returns:
- the encryptor to use when encrypting.
-
-