/* (non-Javadoc)
@see javax.net.ssl.X509KeyManager#chooseServerAlias(java.lang.String, java.security.Principal[], java.net.Socket)
330047
public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) 
	{
		return parent.chooseServerAlias(keyType, issuers, socket);
	}
1101420
private void setSocketOptions() throws SocketException {
        if (DISABLE_NAGLES) {
            // Disable Nagle's algorithm (significant on Windows).
            m_socket.setTcpNoDelay(true);
            m_logger.debug("Nagle's algorithm disabled.");
        }
        if (USE_CUSTOM_BUFFER_SIZE) {
            // Improve default send/receive buffer sizes from default (often 8K).
            if (m_socket.getSendBufferSize() < NET_BUFFER_SIZE) {
                m_logger.debug("SendBufferSize increased from {} to {}",
                               m_socket.getSendBufferSize(), NET_BUFFER_SIZE);
                m_socket.setSendBufferSize(NET_BUFFER_SIZE);
            }
            if (m_socket.getReceiveBufferSize() < NET_BUFFER_SIZE) {
                m_logger.debug("ReceiveBufferSize increased from {} to {}",
                               m_socket.getReceiveBufferSize(), NET_BUFFER_SIZE);
                m_socket.setReceiveBufferSize(NET_BUFFER_SIZE);
            }
        }
    }
344528
private void setIssuer(Object val) throws CertificateException {
        if (!(val instanceof X500Name)) {
            throw new CertificateException(
                             "Issuer class type invalid.");
        }
        issuer = (X500Name)val;
    }
95664
@Override
  public ServerSocketBar bind(ServerSocketBar ss)
    throws ConfigException, IOException, GeneralSecurityException
  {
    throw new ConfigException(L.l("jsse is not allowed here"));
  }
466087
@Autowired
    @Bean
    public WebSecurityConfigurerAdapter casConfigurationServerWebSecurityConfigurerAdapter(final ServerProperties serverProperties) {
        return new WebSecurityConfigurerAdapter() {
            @Override
            protected void configure(final HttpSecurity http) throws Exception {
                super.configure(http);
                val path = serverProperties.getServlet().getContextPath();
                http.authorizeRequests().antMatchers(path + "/decrypt/**").authenticated().and().csrf().disable();
                http.authorizeRequests().antMatchers(path + "/encrypt/**").authenticated().and().csrf().disable();
            }
        };
    }
860594
@Override
    public final void setDefaultLocalAddresses(List<? extends SocketAddress> localAddresses) {
        if (localAddresses == null) {
            throw new NullPointerException("localAddresses");
        }
        setDefaultLocalAddresses((Iterable<? extends SocketAddress>) localAddresses);
    }
222461
public void setRoleSelectionAllowed(boolean editRoles) {

        m_principalTypeSelect.removeItem(CmsRole.PRINCIPAL_ROLE);
        if (editRoles) {
            Item item = m_principalTypeSelect.addItem(CmsRole.PRINCIPAL_ROLE);
            String roleText = CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ROLE_0);
            item.getItemProperty(CmsVaadinUtils.PROPERTY_LABEL).setValue(roleText);
        }
        m_principalTypeSelect.setNewItemsAllowed(!editRoles);

    }
699106
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception {
        for(Protocol protocol : protocols) {
            String protocolName=protocol.getName();

            //traverse class hierarchy and find all annotated fields and add them to the list if annotated
            Field[] fields=Util.getAllDeclaredFieldsWithAnnotations(protocol.getClass(), LocalAddress.class);
            for(int i=0; i < fields.length; i++) {
                Object val=getValueFromProtocol(protocol, fields[i]);
                if(val == null)
                    continue;
                if(!(val instanceof InetAddress))
                    throw new Exception("field " + protocolName + "." + fields[i].getName() + " is not an InetAddress");
                Util.checkIfValidAddress((InetAddress)val, protocolName);
            }
        }
    }
130231
private SocketOptions getSocketOptions(Properties connectionProperties)
    {
        // SocketOptions
        SocketOptions socketConfig = new SocketOptions();

        String connectTimeoutMillis = connectionProperties.getProperty(CassandraConstants.SOCKET_TIMEOUT);
        String readTimeoutMillis = connectionProperties.getProperty("readTimeoutMillis");
        String keepAlive = connectionProperties.getProperty("keepAlive");
        String reuseAddress = connectionProperties.getProperty("reuseAddress");
        String soLinger = connectionProperties.getProperty("soLinger");
        String tcpNoDelay = connectionProperties.getProperty("tcpNoDelay");
        String receiveBufferSize = connectionProperties.getProperty("receiveBufferSize");
        String sendBufferSize = connectionProperties.getProperty("sendBufferSize");

        if (!StringUtils.isBlank(connectTimeoutMillis))
        {
            socketConfig.setConnectTimeoutMillis(new Integer(connectTimeoutMillis));
        }

        if (!StringUtils.isBlank(readTimeoutMillis))
        {
            socketConfig.setReadTimeoutMillis(new Integer(readTimeoutMillis));
        }

        if (!StringUtils.isBlank(keepAlive))
        {
            socketConfig.setKeepAlive(new Boolean(keepAlive));
        }

        if (!StringUtils.isBlank(reuseAddress))
        {
            socketConfig.setReuseAddress(new Boolean(reuseAddress));
        }

        if (!StringUtils.isBlank(soLinger))
        {
            socketConfig.setSoLinger(new Integer(soLinger));
        }

        if (!StringUtils.isBlank(tcpNoDelay))
        {
            socketConfig.setTcpNoDelay(new Boolean(tcpNoDelay));
        }

        if (!StringUtils.isBlank(receiveBufferSize))
        {
            socketConfig.setReceiveBufferSize(new Integer(receiveBufferSize));
        }

        if (!StringUtils.isBlank(sendBufferSize))
        {
            socketConfig.setSendBufferSize(new Integer(sendBufferSize));
        }

        return socketConfig;
    }
756818
protected Map<String, List<Object>> authorizeReleaseOfAllowedAttributes(final Principal principal,
                                                                            final Map<String, List<Object>> attrs,
                                                                            final RegisteredService registeredService,
                                                                            final Service selectedService) {
        val resolvedAttributes = new TreeMap<String, List<Object>>(String.CASE_INSENSITIVE_ORDER);
        resolvedAttributes.putAll(attrs);
        val attributesToRelease = new HashMap<String, List<Object>>();
        /*
         * Map each entry in the allowed list into an array first
         * by the original key, value and the original entry itself.
         * Then process the array to populate the map for allowed attributes
         */
        getAllowedAttributes().forEach((attributeName, value) -> {
            val mappedAttributes = CollectionUtils.wrap(value);
            LOGGER.trace("Attempting to map allowed attribute name [{}]", attributeName);
            val attributeValue = resolvedAttributes.get(attributeName);
            mappedAttributes.forEach(mapped -> {
                val mappedAttributeName = mapped.toString();
                LOGGER.debug("Mapping attribute [{}] to [{}] with value [{}]", attributeName, mappedAttributeName, attributeValue);
                mapSingleAttributeDefinition(attributeName, mappedAttributeName,
                    attributeValue, resolvedAttributes, attributesToRelease);
            });
        });
        return attributesToRelease;
    }
931514
@Override
    protected final void prepareSocket(final SSLSocket socket) {
        String[] supported = socket.getSupportedProtocols();
        String[] enabled = socket.getEnabledProtocols();
        if (LOG.isDebugEnabled()) {
            LOG.debug("socket.getSupportedProtocols(): " + Arrays.toString(supported)
                    + ", socket.getEnabledProtocols(): " + Arrays.toString(enabled));
        }
        List<String> target = new ArrayList<String>();
        if (supported != null) {
            // Append the preferred protocols in descending order of preference
            // but only do so if the protocols are supported
            TLSProtocol[] values = TLSProtocol.values();
            for (int i = 0; i < values.length; i++) {
                final String pname = values[i].getProtocolName();
                if (existsIn(pname, supported)) {
                    target.add(pname);
                }
            }
        }
        if (enabled != null) {
            // Append the rest of the already enabled protocols to the end
            // if not already included in the list
            for (String pname : enabled) {
                if (!target.contains(pname)) {
                    target.add(pname);
                }
            }
        }
        if (target.size() > 0) {
            String[] enabling = target.toArray(new String[target.size()]);
            socket.setEnabledProtocols(enabling);
            if (LOG.isDebugEnabled()) {
                LOG.debug("TLS protocol enabled for SSL handshake: " + Arrays.toString(enabling));
            }
        }
    }
1191143
public <T extends Type> T selectCandidate(T[] candidates, T actual, Environment environment) {
		//
		T candidate = null;
		for (int i = 0; i != candidates.length; ++i) {
			T next = candidates[i];
			if (subtypeOperator.isSubtype(next, actual, environment)) {
				if (candidate == null) {
					candidate = next;
				} else {
					candidate = selectCandidate(candidate, next, actual, environment);
				}
			}
		}
		//
		return candidate;
	}
347669
private static void initJava8SunDefaultEnabledCipherSuites(Map<String, SslCipher> ciphers,
                                                 Map<String, SslCipher> ciphersByNickname) {
        SslCipher cipher;

        // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384",
                "ECDHE-ECDSA-AES256-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AES256,
                CipherMAC.SHA384,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384",
                "ECDHE-RSA-AES256-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA384,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_RSA_WITH_AES_256_CBC_SHA256
        cipher = new SslCipher("TLS_RSA_WITH_AES_256_CBC_SHA256",
                "AES256-SHA256", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384",
                "ECDH-ECDSA-AES256-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES256,
                CipherMAC.SHA384,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384",
                "ECDH-RSA-AES256-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES256,
                CipherMAC.SHA384,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_256_CBC_SHA256",
                "DHE-RSA-AES256-SHA256", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_256_CBC_SHA256",
                "DHE-DSS-AES256-SHA256", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AES256,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
                "ECDHE-ECDSA-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
                "ECDHE-RSA-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_RSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_RSA_WITH_AES_256_CBC_SHA",
                "AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
                "ECDH-ECDSA-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
                "ECDH-RSA-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_RSA_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_256_CBC_SHA",
                "DHE-RSA-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_256_CBC_SHA
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_256_CBC_SHA",
                "DHE-DSS-AES256-SHA", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AES256,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
                "ECDHE-ECDSA-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
                "ECDHE-RSA-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_RSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_RSA_WITH_AES_128_CBC_SHA256",
                "AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256",
                "ECDH-ECDSA-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256",
                "ECDH-RSA-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_128_CBC_SHA256",
                "DHE-RSA-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_128_CBC_SHA256",
                "DHE-DSS-AES128-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AES128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
                "ECDHE-ECDSA-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
                "ECDHE-RSA-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);


        // TLS_RSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_RSA_WITH_AES_128_CBC_SHA",
                "AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);


        // TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
                "ECDH-ECDSA-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
                "ECDH-RSA-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_RSA_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
                "DHE-RSA-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_128_CBC_SHA
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
                "DHE-DSS-AES128-SHA", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AES128,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
                "ECDHE-ECDSA-RC4-SHA", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.RC4,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_RC4_128_SHA
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_RC4_128_SHA",
                "ECDHE-RSA-RC4-SHA", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.RC4,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // SSL_RSA_WITH_RC4_128_SHA
        cipher = new SslCipher("SSL_RSA_WITH_RC4_128_SHA",
                "RC4-SHA", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.RC4,
                CipherMAC.SHA1,
                CipherProtocolVersion.SSLV3,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_RC4_128_SHA
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
                "ECDH-ECDSA-RC4-SHA", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.RC4,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_RC4_128_SHA
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_RC4_128_SHA",
                "ECDH-RSA-RC4-SHA", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.RC4,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
                "ECDHE-ECDSA-AES256-GCM-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AESGCM256,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
                "ECDHE-ECDSA-AES128-GCM-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.AESGCM128,
                CipherMAC.SHA256,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
                "ECDHE-RSA-AES256-GCM-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM256,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_RSA_WITH_AES_256_GCM_SHA384
        cipher = new SslCipher("TLS_RSA_WITH_AES_256_GCM_SHA384",
                "AES256-GCM-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM256,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
        // openssl doesn't have it

        // TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
        // openssl doesn't have it

        // TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_256_GCM_SHA384",
                "DHE-RSA-AES256-GCM-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM256,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_256_GCM_SHA384",
                "DHE-DSS-AES256-GCM-SHA384", 256,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AESGCM256,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                "ECDHE-RSA-AES128-GCM-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM128,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_RSA_WITH_AES_128_GCM_SHA256
        cipher = new SslCipher("TLS_RSA_WITH_AES_128_GCM_SHA256",
                "AES128-GCM-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM128,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
        // openssl doesn't have it

        // TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
        // openssl doesn't have it

        // TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
        cipher = new SslCipher("TLS_DHE_RSA_WITH_AES_128_GCM_SHA256",
                "DHE-RSA-AES128-GCM-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.AESGCM128,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
        cipher = new SslCipher("TLS_DHE_DSS_WITH_AES_128_GCM_SHA256",
                "DHE-DSS-AES128-GCM-SHA256", 128,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.AESGCM128,
                CipherMAC.AEAD,
                CipherProtocolVersion.TLSV1_2,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
                "ECDHE-ECDSA-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.ECDSA,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
                "ECDHE-RSA-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDHE,
                CipherAuthentication.RSA,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // SSL_RSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("SSL_RSA_WITH_3DES_EDE_CBC_SHA",
                "DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.SSLV3,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA",
                "ECDH-ECDSA-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_ECDSA,
                CipherAuthentication.ECDH,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
                "ECDH-RSA-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.ECDH_RSA,
                CipherAuthentication.ECDH,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.TLSV1,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
                "EDH-RSA-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.RSA,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.SSLV3,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
        cipher = new SslCipher("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
                "EDH-DSS-DES-CBC3-SHA", 168,
                CipherStrength.HIGH,
                CipherKeyExchange.DHE,
                CipherAuthentication.DSS,
                CipherEncryption.TripleDES,
                CipherMAC.SHA1,
                CipherProtocolVersion.SSLV3,
                true);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // SSL_RSA_WITH_RC4_128_MD5
        cipher = new SslCipher("SSL_RSA_WITH_RC4_128_MD5",
                "RC4-MD5", 128,
                CipherStrength.MEDIUM,
                CipherKeyExchange.RSA,
                CipherAuthentication.RSA,
                CipherEncryption.RC4,
                CipherMAC.MD5,
                CipherProtocolVersion.SSLV3,
                false);
        ciphers.putIfAbsent(cipher.name, cipher);
        ciphersByNickname.putIfAbsent(cipher.nickname, cipher);

        // TLS_EMPTY_RENEGOTIATION_INFO_SCSV
        // openssl doesn't have it
    }
614095
protected void setPrincipal(int type, String principalName) {

        m_principalName.setValue(principalName);

        String typeName = null;
        switch (type) {
            case 0:
                typeName = I_CmsPrincipal.PRINCIPAL_GROUP;
                break;
            case 1:
            default:
                typeName = I_CmsPrincipal.PRINCIPAL_USER;
                break;
        }
        if (typeName != null) {
            m_principalTypeSelect.setValue(typeName);
        }
    }
113379
public void setOption(int optID, Object o) throws SocketException {
         if (isClosed()) {
             throw new SocketException("Socket Closed");
         }
         switch (optID) {
            /* check type safety b4 going native.  These should never
             * fail, since only java.Socket* has access to
             * PlainSocketImpl.setOption().
             */
         case SO_TIMEOUT:
             if (o == null || !(o instanceof Integer)) {
                 throw new SocketException("bad argument for SO_TIMEOUT");
             }
             int tmp = ((Integer) o).intValue();
             if (tmp < 0)
                 throw new IllegalArgumentException("timeout < 0");
             timeout = tmp;
             return;
         case IP_TOS:
             if (o == null || !(o instanceof Integer)) {
                 throw new SocketException("bad argument for IP_TOS");
             }
             trafficClass = ((Integer)o).intValue();
             break;
         case SO_REUSEADDR:
             if (o == null || !(o instanceof Boolean)) {
                 throw new SocketException("bad argument for SO_REUSEADDR");
             }
             break;
         case SO_BROADCAST:
             if (o == null || !(o instanceof Boolean)) {
                 throw new SocketException("bad argument for SO_BROADCAST");
             }
             break;
         case SO_BINDADDR:
             throw new SocketException("Cannot re-bind Socket");
         case SO_RCVBUF:
         case SO_SNDBUF:
             if (o == null || !(o instanceof Integer) ||
                 ((Integer)o).intValue() < 0) {
                 throw new SocketException("bad argument for SO_SNDBUF or " +
                                           "SO_RCVBUF");
             }
             break;
         case IP_MULTICAST_IF:
             if (o == null || !(o instanceof InetAddress))
                 throw new SocketException("bad argument for IP_MULTICAST_IF");
             break;
         case IP_MULTICAST_IF2:
             if (o == null || !(o instanceof Integer || o instanceof NetworkInterface))
                 throw new SocketException("bad argument for IP_MULTICAST_IF2");
             if (o instanceof NetworkInterface) {
                 o = new Integer(((NetworkInterface)o).getIndex());
             }
             break;
         case IP_MULTICAST_LOOP:
             if (o == null || !(o instanceof Boolean))
                 throw new SocketException("bad argument for IP_MULTICAST_LOOP");
             break;
         default:
             throw new SocketException("invalid option: " + optID);
         }
         socketSetOption(optID, o);
     }
695472
private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {


        AuthorisationDecision decision = new AuthorisationDecision(true);
        for(AddressTemplate ref : requiredResources)
        {
            if(ref.isOptional()) continue; // skip optional ones

            final Constraints model = getConstraints(ref, includeOptional);
            if(model!=null)
            {
                if(!p.isGranted(model))
                {
                    decision.getErrorMessages().add(ref.toString());
                }
            }
            else
            {
                decision.getErrorMessages().add("Missing constraints for "+ ref.toString());
            }

            if(decision.hasErrorMessages())
            {
                decision.setGranted(false);
                break;
            }
        }

        return decision;
    }
1310163
X509Certificate selectCertificate(final CertStore store,
			final Collection<X509CertSelector> selectors) throws CertStoreException {
		for (CertSelector selector : selectors) {
			LOGGER.debug("Selecting certificate using {}", selector);
			Collection<? extends Certificate> certs = store
					.getCertificates(selector);
			if (certs.size() > 0) {
				LOGGER.debug("Selected {} certificate(s) using {}",
						certs.size(), selector);
				return (X509Certificate) certs.iterator().next();
			} else {
				LOGGER.debug("No certificates selected");
			}
		}
		return (X509Certificate) store.getCertificates(null).iterator().next();
	}