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 StringSTRATEGY_NAMEstatic StringSTRATEGY_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 Stringdecrypt(String value)Stringencrypt(String value)StringgenerateKey()StringgetConfigFile()StringgetDefaultKeyName()Set<String>getKeyNames()StringgetName()voidimportConfig(File configFile)booleanisEncrypted(String value)voidreloadSettings()voidsetDefaultKey(String defaultEncryptionKey, Runnable onKeysChanged)voidsetFileWatcherFactory(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:
encryptin interfaceEncryptionStrategy
-
decrypt
public String decrypt(String value)
- Specified by:
decryptin interfaceEncryptionStrategy
-
isEncrypted
public boolean isEncrypted(String value)
- Specified by:
isEncryptedin interfaceEncryptionStrategy
-
getDefaultKeyName
public String getDefaultKeyName()
- Specified by:
getDefaultKeyNamein interfaceEncryptionStrategy
-
getKeyNames
public Set<String> getKeyNames()
- Specified by:
getKeyNamesin interfaceEncryptionStrategy
-
getName
public String getName()
- Specified by:
getNamein interfaceEncryptionStrategy
-
validate
public Optional<String> validate(@Nullable String key)
- Specified by:
validatein interfaceEncryptionStrategy- Parameters:
key- string representation of encryption key- Returns:
Optional.empty()if {@param key} string is valid,Optionalcontains an error message otherwise
-
setDefaultKey
public void setDefaultKey(String defaultEncryptionKey, Runnable onKeysChanged)
- Specified by:
setDefaultKeyin interfaceEncryptionStrategy
-
generateKey
public String generateKey()
- Specified by:
generateKeyin interfaceEncryptionStrategy
-
reloadSettings
public void reloadSettings()
- Specified by:
reloadSettingsin interfaceEncryptionStrategy
-
getConfigFile
public String getConfigFile()
- Specified by:
getConfigFilein interfaceFileConfigBasedEncryptionStrategy
-
importConfig
public void importConfig(@NotNull File configFile)- Specified by:
importConfigin interfaceFileConfigBasedEncryptionStrategy
-
-