| | |
| | | } |
| | | |
| | | /** |
| | | * Initialize the parser with the Gloabal options ans subcommands. |
| | | * Initialize the parser with the Global options and subcommands. |
| | | * |
| | | * @param outStream |
| | | * The output stream to use for standard output, or <CODE>null</CODE> |
| | |
| | | * Initialize Global option. |
| | | * |
| | | * @param outStream |
| | | * The output stream used forn the usage. |
| | | * The output stream used for the usage. |
| | | * @throws ArgumentException |
| | | * If there is a problem with any of the parameters used |
| | | * to create this argument. |
| | |
| | | { |
| | | // Nothing to do: if this occurs we will systematically refuse the |
| | | // certificates. Maybe we should avoid this and be strict, but we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the truststore", e); |
| | | } |
| | | catch (NoSuchAlgorithmException e) |
| | | { |
| | | // Nothing to do: if this occurs we will systematically refuse the |
| | | // certificates. Maybe we should avoid this and be strict, but we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the truststore", e); |
| | | } |
| | | catch (CertificateException e) |
| | | { |
| | | // Nothing to do: if this occurs we will systematically refuse the |
| | | // certificates. Maybe we should avoid this and be strict, but we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the truststore", e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | // Nothing to do: if this occurs we will systematically refuse the |
| | | // certificates. Maybe we should avoid this and be strict, but we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the truststore", e); |
| | | } |
| | | } |
| | |
| | | // Nothing to do: if this occurs we will systematically refuse |
| | | // the |
| | | // certificates. Maybe we should avoid this and be strict, but |
| | | // we are |
| | | // in a best effor mode. |
| | | // we are in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the keystore", e); |
| | | } |
| | | catch (NoSuchAlgorithmException e) |
| | |
| | | // the |
| | | // certificates. Maybe we should avoid this and be strict, but |
| | | // we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the keystore", e); |
| | | } |
| | | catch (CertificateException e) |
| | |
| | | // the |
| | | // certificates. Maybe we should avoid this and be strict, but |
| | | // we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the keystore", e); |
| | | } |
| | | catch (IOException e) |
| | |
| | | // the |
| | | // certificates. Maybe we should avoid this and be strict, but |
| | | // we are |
| | | // in a best effor mode. |
| | | // in a best effort mode. |
| | | LOG.log(Level.WARNING, "Error with the keystore", e); |
| | | } |
| | | ApplicationKeyManager akm = new ApplicationKeyManager(keyStore, |
| | |
| | | */ |
| | | public int validateGlobalOption(PrintStream err) |
| | | { |
| | | ReturnCode returnCode = ReturnCode.SUCCESSFUL_NOP; |
| | | |
| | | // Couldn't have at the same time bindPassword and bindPasswordFile |
| | | if(bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent()) |
| | | { |
| | |
| | | String message = getMessage(msgID, bindPasswordArg.getLongIdentifier(), |
| | | bindPasswordFileArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | |
| | | // Couldn't have at the same time trustAll and |
| | |
| | | String message = getMessage(msgID, trustAllArg.getLongIdentifier(), |
| | | trustStorePathArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | if (trustAllArg.isPresent() && trustStorePasswordArg.isPresent()) |
| | | { |
| | |
| | | String message = getMessage(msgID, trustAllArg.getLongIdentifier(), |
| | | trustStorePasswordArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | if (trustAllArg.isPresent() && trustStorePasswordFileArg.isPresent()) |
| | | { |
| | |
| | | String message = getMessage(msgID, trustAllArg.getLongIdentifier(), |
| | | trustStorePasswordFileArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | |
| | | // Couldn't have at the same time trustStorePasswordArg and |
| | |
| | | String message = getMessage(msgID, trustStorePasswordArg |
| | | .getLongIdentifier(), trustStorePasswordFileArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | |
| | | // Couldn't have at the same time startTLSArg and |
| | |
| | | String message = getMessage(msgID, startTLSArg |
| | | .getLongIdentifier(), useSSLArg.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return returnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | return ReturnCode.CONFLICTING_ARGS.getReturnCode(); |
| | | } |
| | | |
| | | return ReturnCode.SUCCESSFUL_NOP.getReturnCode(); |