Class CustomKeyEncryptionStrategy
- java.lang.Object
-
- jetbrains.buildServer.serverSide.crypt.CustomKeyEncryptionStrategy
-
- All Implemented Interfaces:
EncryptionStrategy
,FileConfigBasedEncryptionStrategy
@Service @Lazy public class CustomKeyEncryptionStrategy extends Object implements FileConfigBasedEncryptionStrategy
Class represents an encryption strategy based on AES encryption algorithm and a user-specified 256-bit key. All user keys are stored in the config file in the data directory.- Since:
- 2020.1
-
-
Field Summary
Fields Modifier and Type Field Description static String
STRATEGY_NAME
static String
STRATEGY_PREFIX
-
Constructor Summary
Constructors Constructor Description CustomKeyEncryptionStrategy(ServerPaths serverPaths, SettingsPersister settingsPersister, ServerResponsibility serverResponsibility)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
decrypt(String value)
String
encrypt(String value)
String
generateKey()
String
getConfigFile()
String
getDefaultKeyName()
Set<String>
getKeyNames()
String
getName()
void
importConfig(File configFile)
boolean
isEncrypted(String value)
void
reloadSettings()
void
setDefaultKey(String defaultEncryptionKey, Runnable onKeysChanged)
void
setFileWatcherFactory(FileWatcherFactory fileWatcherFactory)
Optional<String>
validate(String key)
-
-
-
Field Detail
-
STRATEGY_NAME
public static final String STRATEGY_NAME
- See Also:
- Constant Field Values
-
STRATEGY_PREFIX
public static final String STRATEGY_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CustomKeyEncryptionStrategy
public CustomKeyEncryptionStrategy(@NotNull ServerPaths serverPaths, @NotNull SettingsPersister settingsPersister, @NotNull ServerResponsibility serverResponsibility)
-
-
Method Detail
-
setFileWatcherFactory
@Autowired public void setFileWatcherFactory(@NotNull FileWatcherFactory fileWatcherFactory)
-
encrypt
public String encrypt(@NotNull String value)
- Specified by:
encrypt
in interfaceEncryptionStrategy
-
decrypt
public String decrypt(String value)
- Specified by:
decrypt
in interfaceEncryptionStrategy
-
isEncrypted
public boolean isEncrypted(String value)
- Specified by:
isEncrypted
in interfaceEncryptionStrategy
-
getDefaultKeyName
public String getDefaultKeyName()
- Specified by:
getDefaultKeyName
in interfaceEncryptionStrategy
-
getKeyNames
public Set<String> getKeyNames()
- Specified by:
getKeyNames
in interfaceEncryptionStrategy
-
getName
public String getName()
- Specified by:
getName
in interfaceEncryptionStrategy
-
validate
public Optional<String> validate(@Nullable String key)
- Specified by:
validate
in interfaceEncryptionStrategy
- Parameters:
key
- string representation of encryption key- Returns:
Optional.empty()
if {@param key} string is valid,Optional
contains an error message otherwise
-
setDefaultKey
public void setDefaultKey(String defaultEncryptionKey, Runnable onKeysChanged)
- Specified by:
setDefaultKey
in interfaceEncryptionStrategy
-
generateKey
public String generateKey()
- Specified by:
generateKey
in interfaceEncryptionStrategy
-
reloadSettings
public void reloadSettings()
- Specified by:
reloadSettings
in interfaceEncryptionStrategy
-
getConfigFile
public String getConfigFile()
- Specified by:
getConfigFile
in interfaceFileConfigBasedEncryptionStrategy
-
importConfig
public void importConfig(@NotNull File configFile)
- Specified by:
importConfig
in interfaceFileConfigBasedEncryptionStrategy
-
-