public class PrefixBasedSwitchableEncryptor extends Object implements SwitchableEncryptor
| Constructor and Description |
|---|
PrefixBasedSwitchableEncryptor(EncryptionSettings encryptionSettings,
Map<String,Encryptor> encryptors) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeEncryptionKey()
Generate new encryption key, which should be used to encrypt password in following calls to
Encryptor.encrypt(java.lang.String). |
String |
decrypt(String encryptedPassword)
Decrypt encrypted password, and return its original value.
|
String |
encrypt(String password)
Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
|
Collection<String> |
getAvailableEncryptorKeys() |
Optional<String> |
getCurrentEncryptorKey() |
protected Encryptor |
getEncryptor(String encryptorKey) |
void |
switchEncryptor(String encryptorKey)
Switches the
Encryptor to the one specified by encryptorKey or disable encryption when
encryptorKey is null. |
public PrefixBasedSwitchableEncryptor(EncryptionSettings encryptionSettings, Map<String,Encryptor> encryptors)
public String encrypt(String password)
Encryptorpublic String decrypt(String encryptedPassword)
Encryptor
In case of any error during decryption (such as missing decryption key) return encryptedPassword.
public void switchEncryptor(String encryptorKey)
SwitchableEncryptorEncryptor to the one specified by encryptorKey or disable encryption when
encryptorKey is null.switchEncryptor in interface SwitchableEncryptorencryptorKey - identifies one of the Encryptor or no encryption when null.public boolean changeEncryptionKey()
EncryptorEncryptor.encrypt(java.lang.String).changeEncryptionKey in interface Encryptorpublic Collection<String> getAvailableEncryptorKeys()
getAvailableEncryptorKeys in interface SwitchableEncryptorpublic Optional<String> getCurrentEncryptorKey()
getCurrentEncryptorKey in interface SwitchableEncryptorEncryptor or Optional.empty() when encryption is disabledCopyright © 2024 Atlassian. All rights reserved.