| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Processes the command-line arguments and performs the requested action. |
| | | * |
| | |
| | | return encodePassword(args, true, System.out, System.err); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Processes the command-line arguments and performs the requested action. |
| | | * |
| | |
| | | StringArgument configFile = null; |
| | | StringArgument schemeName = null; |
| | | |
| | | |
| | | // Create the command-line argument parser for use with this program. |
| | | LocalizableMessage toolDescription = INFO_ENCPW_TOOL_DESCRIPTION.get(); |
| | | ArgumentParser argParser = |
| | |
| | | return OPERATIONS_ERROR; |
| | | } |
| | | |
| | | |
| | | // Parse the command-line arguments provided to this program. |
| | | try |
| | | { |
| | |
| | | return OPERATIONS_ERROR; |
| | | } |
| | | |
| | | |
| | | // If we should just display usage or version information, |
| | | // then we've already done it so just return without doing anything else. |
| | | if (argParser.usageOrVersionDisplayed()) |
| | |
| | | return OPERATIONS_ERROR; |
| | | } |
| | | |
| | | |
| | | // Determine whether we're encoding the clear-text password or comparing it |
| | | // against an already-encoded password. |
| | | boolean compareMode; |
| | |
| | | compareMode = false; |
| | | } |
| | | |
| | | |
| | | if (initializeServer) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // If we are only trying to list the available schemes, then do so and exit. |
| | | if (listSchemes.isPresent()) |
| | | { |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | // Either encode the clear-text password using the provided scheme, or |
| | | // compare the clear-text password against the encoded password. |
| | | ByteString clearPW = null; |
| | |
| | | } |
| | | |
| | | private static void listPasswordStorageSchemes(PrintStream out, PrintStream err, |
| | | ConcurrentHashMap<String, PasswordStorageScheme> storageSchemes, boolean authPasswordSchemeName) |
| | | ConcurrentHashMap<String, PasswordStorageScheme<?>> storageSchemes, boolean authPasswordSchemeName) |
| | | { |
| | | if (storageSchemes.isEmpty()) |
| | | { |
| | |
| | | return password; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Thread that mask user input. |
| | | */ |
| | | /** Thread that mask user input. */ |
| | | private class ErasingThread extends Thread |
| | | { |
| | | |
| | | private boolean stop; |
| | | private String prompt; |
| | | |
| | |
| | | this.prompt = prompt; |
| | | } |
| | | |
| | | /** |
| | | * Begin masking until asked to stop. |
| | | */ |
| | | /** Begin masking until asked to stop. */ |
| | | @Override |
| | | public void run() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Instruct the thread to stop masking. |
| | | */ |
| | | /** Instruct the thread to stop masking. */ |
| | | public void stopMasking() |
| | | { |
| | | this.stop = true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |