Package org.wildfly.security.tool
Class VaultCommand
- java.lang.Object
-
- org.wildfly.security.tool.Command
-
- org.wildfly.security.tool.VaultCommand
-
public class VaultCommand extends Command
Command to perform conversion from former Vault storage to Credential Store (KeyStoreCredentialStore).- Author:
- Peter Skopek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
VaultCommand.Descriptor
-
Field Summary
Fields Modifier and Type Field Description static String
ALIAS_PARAM
static String
BULK_CONVERT_PARAM
private org.apache.commons.cli.CommandLine
cmdLine
static String
DEBUG_PARAM
(package private) static String
defaultKeyStoreType
static String
ENC_DIR_PARAM
static String
FAIL_IF_EXIST_PARAM
static String
HELP_PARAM
static String
ITERATION_PARAM
static String
KEYSTORE_PARAM
static String
KEYSTORE_PASSWORD_PARAM
private org.apache.commons.cli.Options
options
private org.apache.commons.cli.CommandLineParser
parser
static String
PRINT_SUMMARY_PARAM
static String
SALT_PARAM
static String
STORE_LOCATION_PARAM
static String
VAULT_COMMAND
-
Fields inherited from class org.wildfly.security.tool.Command
GENERAL_CONFIGURATION_ERROR, INPUT_DATA_NOT_CONFIRMED, WIDTH
-
-
Constructor Summary
Constructors Constructor Description VaultCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkInvalidOptions(String... invalidOptions)
private HashMap<String,String>
convert(String keyStoreURL, String vaultPassword, String encryptionDirectory, String salt, int iterationCount, String secretKeyAlias, String outputFile, Map<String,String> csAttributes, String csType, String csProvider, String csOtherProviders)
private String
convertedStoreName(String encryptionDirectory, Map<String,String> implProps)
private char[]
decodeMaskedPassword(String password, String salt, int iterationCount)
void
execute(String[] args)
private CredentialStore.CredentialSourceProtectionParameter
getCredentialStoreProtectionParameter(String vaultPassword, String salt, int iterationCount)
private CredentialStore.CredentialSourceProtectionParameter
getVaultCredentialStoreProtectionParameter(String keyStoreURL, String vaultPassword, String salt, int iterationCount, String secretKeyAlias)
void
help()
Display help to the command.private List<VaultCommand.Descriptor>
parseDescriptorFile(String descriptorFileLocation)
private void
printSummary(String keystorePassword, String salt, int iterationCount, Map<String,String> implProps)
-
Methods inherited from class org.wildfly.security.tool.Command
aliases, getProvidersSupplier, getStatus, getToolCommand, isAlias, isEnableDebug, isWindows, printDuplicatesWarning, printDuplicatesWarning, prompt, setEnableDebug, setStatus, setToolCommand
-
-
-
-
Field Detail
-
defaultKeyStoreType
static final String defaultKeyStoreType
- See Also:
- Constant Field Values
-
options
private final org.apache.commons.cli.Options options
-
parser
private org.apache.commons.cli.CommandLineParser parser
-
cmdLine
private org.apache.commons.cli.CommandLine cmdLine
-
VAULT_COMMAND
public static final String VAULT_COMMAND
- See Also:
- Constant Field Values
-
STORE_LOCATION_PARAM
public static final String STORE_LOCATION_PARAM
- See Also:
- Constant Field Values
-
PRINT_SUMMARY_PARAM
public static final String PRINT_SUMMARY_PARAM
- See Also:
- Constant Field Values
-
FAIL_IF_EXIST_PARAM
public static final String FAIL_IF_EXIST_PARAM
- See Also:
- Constant Field Values
-
BULK_CONVERT_PARAM
public static String BULK_CONVERT_PARAM
-
KEYSTORE_PARAM
public static final String KEYSTORE_PARAM
- See Also:
- Constant Field Values
-
KEYSTORE_PASSWORD_PARAM
public static final String KEYSTORE_PASSWORD_PARAM
- See Also:
- Constant Field Values
-
ENC_DIR_PARAM
public static final String ENC_DIR_PARAM
- See Also:
- Constant Field Values
-
SALT_PARAM
public static final String SALT_PARAM
- See Also:
- Constant Field Values
-
ITERATION_PARAM
public static final String ITERATION_PARAM
- See Also:
- Constant Field Values
-
ALIAS_PARAM
public static final String ALIAS_PARAM
- See Also:
- Constant Field Values
-
HELP_PARAM
public static final String HELP_PARAM
- See Also:
- Constant Field Values
-
DEBUG_PARAM
public static final String DEBUG_PARAM
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkInvalidOptions
private void checkInvalidOptions(String... invalidOptions) throws Exception
- Throws:
Exception
-
convertedStoreName
private String convertedStoreName(String encryptionDirectory, Map<String,String> implProps)
-
convert
private HashMap<String,String> convert(String keyStoreURL, String vaultPassword, String encryptionDirectory, String salt, int iterationCount, String secretKeyAlias, String outputFile, Map<String,String> csAttributes, String csType, String csProvider, String csOtherProviders) throws Exception
- Throws:
Exception
-
parseDescriptorFile
private List<VaultCommand.Descriptor> parseDescriptorFile(String descriptorFileLocation) throws IOException
- Throws:
IOException
-
getCredentialStoreProtectionParameter
private CredentialStore.CredentialSourceProtectionParameter getCredentialStoreProtectionParameter(String vaultPassword, String salt, int iterationCount) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
getVaultCredentialStoreProtectionParameter
private CredentialStore.CredentialSourceProtectionParameter getVaultCredentialStoreProtectionParameter(String keyStoreURL, String vaultPassword, String salt, int iterationCount, String secretKeyAlias) throws GeneralSecurityException, IOException
- Throws:
GeneralSecurityException
IOException
-
decodeMaskedPassword
private char[] decodeMaskedPassword(String password, String salt, int iterationCount) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
printSummary
private void printSummary(String keystorePassword, String salt, int iterationCount, Map<String,String> implProps) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
-