Package org.apache.tomcat.vault
Class VaultSession
- java.lang.Object
-
- org.apache.tomcat.vault.VaultSession
-
-
Field Summary
Fields Modifier and Type Field Description static StringVAULT_ENC_ALGORITHM
-
Constructor Summary
Constructors Constructor Description VaultSession(String keystoreURL, String keystorePassword, String encryptionDirectory, String salt, int iterationCount)Constructor to create VaultSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSecuredAttribute(String vaultBlock, String attributeName, char[] attributeValue)Add secured attribute to specified vault block.booleancheckSecuredAttribute(String vaultBlock, String attributeName)Check whether secured attribute is already set for given vault block and attribute name.voidencryptValueWithCRYPT(String encryptionPassword, String valueToEncrypt)Encrypt a value using the CRYPT feature.voidoutputConfig(PrintStream out)Print AS7 configuration file to stream.voidremoveSecuredAttribute(String vaultBlock, String attributeName)Remove secured attribute with given vault block and attribute name.voidstartVaultSession(String vaultAlias)Start the vault with given alias.protected voidvalidateEncryptionDirectory()protected voidvalidateIterationCount()protected voidvalidateKeystorePassword()protected voidvalidateKeystoreURL()protected voidvalidateSalt()voidvaultConfigurationDisplay()Display info about vault itself in form of AS7 configuration file.
-
-
-
Field Detail
-
VAULT_ENC_ALGORITHM
public static final String VAULT_ENC_ALGORITHM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VaultSession
public VaultSession(String keystoreURL, String keystorePassword, String encryptionDirectory, String salt, int iterationCount) throws Exception
Constructor to create VaultSession.- Parameters:
keystoreURL-keystorePassword-encryptionDirectory-salt-iterationCount-- Throws:
Exception
-
-
Method Detail
-
validateKeystorePassword
protected void validateKeystorePassword() throws Exception- Throws:
Exception
-
validateEncryptionDirectory
protected void validateEncryptionDirectory() throws Exception- Throws:
Exception
-
startVaultSession
public void startVaultSession(String vaultAlias) throws Exception
Start the vault with given alias.- Parameters:
vaultAlias-- Throws:
Exception
-
addSecuredAttribute
public void addSecuredAttribute(String vaultBlock, String attributeName, char[] attributeValue) throws Exception
Add secured attribute to specified vault block. This method can be called only after successful startVaultSession() call.- Parameters:
vaultBlock-attributeName-attributeValue-- Throws:
Exception
-
checkSecuredAttribute
public boolean checkSecuredAttribute(String vaultBlock, String attributeName) throws Exception
Check whether secured attribute is already set for given vault block and attribute name. This method can be called only after successful startVaultSession() call.- Parameters:
vaultBlock-attributeName-- Returns:
- true is password already exists for given vault block and attribute name.
- Throws:
Exception
-
removeSecuredAttribute
public void removeSecuredAttribute(String vaultBlock, String attributeName) throws Exception
Remove secured attribute with given vault block and attribute name. This method can be called only after successful startVaultSession() call.- Parameters:
vaultBlock-attributeName-- Throws:
Exception
-
encryptValueWithCRYPT
public void encryptValueWithCRYPT(String encryptionPassword, String valueToEncrypt) throws Exception
Encrypt a value using the CRYPT feature.- Parameters:
encryptionPassword- Encryption password; could be stored in the vaultvalueToEncrypt-- Throws:
Exception- if there is an issue retrieving the encryptionPassword from the vault.
-
vaultConfigurationDisplay
public void vaultConfigurationDisplay()
Display info about vault itself in form of AS7 configuration file.
-
outputConfig
public void outputConfig(PrintStream out)
Print AS7 configuration file to stream.- Parameters:
out- stream to print config.
-
-