/** * This API return an array of String listing the enabled cipher suites. Input is the * cipherSuiteStr from xml which a space separated list ciphers with a prefix '+' indicating * enabled, '-' indicating disabled. If no cipher is enabled, then it returns an empty array. If * no cipher is specified, then all are enabled and it returns null. * * @param cipherSuiteStr cipherSuiteStr from xml * @param ssl2Enabled * @param ssl3Enabled * @param tlsEnabled * @return an array of enabled Ciphers */ private String[] getEnabledCipherSuites( String cipherSuiteStr, boolean ssl2Enabled, boolean ssl3Enabled, boolean tlsEnabled) { String[] cipherArr = null; if (cipherSuiteStr != null && cipherSuiteStr.length() > 0) { ArrayList cipherList = new ArrayList(); StringTokenizer tokens = new StringTokenizer(cipherSuiteStr, ","); while (tokens.hasMoreTokens()) { String cipherAction = tokens.nextToken(); if (cipherAction.startsWith("+")) { String cipher = cipherAction.substring(1); CipherInfo cipherInfo = CipherInfo.getCipherInfo(cipher); if (cipherInfo != null && isValidProtocolCipher(cipherInfo, ssl2Enabled, ssl3Enabled, tlsEnabled)) { cipherList.add(cipherInfo.getCipherName()); } else { throw new IllegalStateException( getFormatMessage("iiop.unknown_cipher", new Object[] {cipher})); } } else if (cipherAction.startsWith("-")) { String cipher = cipherAction.substring(1); CipherInfo cipherInfo = CipherInfo.getCipherInfo(cipher); if (cipherInfo == null || !isValidProtocolCipher(cipherInfo, ssl2Enabled, ssl3Enabled, tlsEnabled)) { throw new IllegalStateException( getFormatMessage("iiop.unknown_cipher", new Object[] {cipher})); } } else if (cipherAction.trim().length() > 0) { throw new IllegalStateException( getFormatMessage("iiop.invalid_cipheraction", new Object[] {cipherAction})); } } cipherArr = (String[]) cipherList.toArray(new String[cipherList.size()]); } return cipherArr; }