fix: Fix rebuild-index in FIPS mode (#189)
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.Optional; |
| | | import java.util.StringTokenizer; |
| | | import java.util.TimeZone; |
| | | |
| | |
| | | return ERR_TOOL_CONFLICTING_ARGS.get(arg1.getLongIdentifier(), arg2.getLongIdentifier()); |
| | | } |
| | | |
| | | /** |
| | | * Returns value of first present {@link Argument}. |
| | | * |
| | | * @param args |
| | | * Array of {@link Argument} which should checked |
| | | */ |
| | | public static String getFirstArgumentValue(final Argument ... args) { |
| | | if (args == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (Argument arg : args) { |
| | | if (arg.isPresent()) { |
| | | return arg.getValue(); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.forgerock.opendj.cli.ConnectionFactoryProvider; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.isFips; |
| | | |
| | | /** |
| | | * This class provides SSL connection related utility functions. |
| | |
| | | getTrustManagers(KeyStore.getDefaultType(), null, trustStorePath, |
| | | trustStorePassword); |
| | | trustManagers = new TrustManager[tmpTrustManagers.length]; |
| | | for (int i=0; i < trustManagers.length; i++) |
| | | { |
| | | trustManagers[i] = |
| | | new ExpirationCheckTrustManager((X509TrustManager) |
| | | tmpTrustManagers[i]); |
| | | if (isFips()) { |
| | | trustManagers = tmpTrustManagers; |
| | | } else { |
| | | for (int i=0; i < trustManagers.length; i++) |
| | | { |
| | | trustManagers[i] = |
| | | new ExpirationCheckTrustManager((X509TrustManager) |
| | | tmpTrustManagers[i]); |
| | | } |
| | | } |
| | | } |
| | | if(keyStorePath != null) |
| | |
| | | SSLConnectionFactory sslConnectionFactory = new SSLConnectionFactory(); |
| | | sslConnectionFactory.init(args.getTrustAllArg().isPresent(), |
| | | args.getKeyStorePathArg().getValue(), |
| | | args.getKeyStorePasswordArg().getValue(), |
| | | getFirstArgumentValue(args.getKeyStorePasswordArg(), args.getKeyStorePasswordFileArg()), |
| | | clientAlias, |
| | | args.getTrustStorePathArg().getValue(), |
| | | args.getTrustStorePasswordArg().getValue()); |
| | | getFirstArgumentValue(args.getTrustStorePasswordArg(), args.getTrustStorePasswordFileArg())); |
| | | connectionOptions.setSSLConnectionFactory(sslConnectionFactory); |
| | | } |
| | | catch (SSLConnectionException sce) |