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 classVaultCommand.Descriptor
-
Field Summary
Fields Modifier and Type Field Description static StringALIAS_PARAMstatic StringBULK_CONVERT_PARAMprivate org.apache.commons.cli.CommandLinecmdLinestatic StringDEBUG_PARAM(package private) static StringdefaultKeyStoreTypestatic StringENC_DIR_PARAMstatic StringFAIL_IF_EXIST_PARAMstatic StringHELP_PARAMstatic StringITERATION_PARAMstatic StringKEYSTORE_PARAMstatic StringKEYSTORE_PASSWORD_PARAMprivate org.apache.commons.cli.Optionsoptionsprivate org.apache.commons.cli.CommandLineParserparserstatic StringPRINT_SUMMARY_PARAMstatic StringSALT_PARAMstatic StringSTORE_LOCATION_PARAMstatic StringVAULT_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 voidcheckInvalidOptions(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 StringconvertedStoreName(String encryptionDirectory, Map<String,String> implProps)private char[]decodeMaskedPassword(String password, String salt, int iterationCount)voidexecute(String[] args)private CredentialStore.CredentialSourceProtectionParametergetCredentialStoreProtectionParameter(String vaultPassword, String salt, int iterationCount)private CredentialStore.CredentialSourceProtectionParametergetVaultCredentialStoreProtectionParameter(String keyStoreURL, String vaultPassword, String salt, int iterationCount, String secretKeyAlias)voidhelp()Display help to the command.private List<VaultCommand.Descriptor>parseDescriptorFile(String descriptorFileLocation)private voidprintSummary(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:
GeneralSecurityExceptionIOException
-
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
-
-