Java Code Examples for javax.net.ssl.SSLParameters#getAlgorithmConstraints()

The following examples show how to use javax.net.ssl.SSLParameters#getAlgorithmConstraints() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SSLServerSocketImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 2
Source File: SSLServerSocketImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 3
Source File: SSLServerSocketImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 4
Source File: SSLServerSocketImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
    applicationProtocols = params.getApplicationProtocols();
}
 
Example 5
Source File: SSLServerSocketImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 6
Source File: SSLServerSocketImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
public synchronized void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
    applicationProtocols = params.getApplicationProtocols();
}
 
Example 7
Source File: SSLServerSocketImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 8
Source File: SSLServerSocketImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 9
Source File: SSLServerSocketImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 10
Source File: SSLServerSocketImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 11
Source File: SSLServerSocketImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
    applicationProtocols = params.getApplicationProtocols();
}
 
Example 12
Source File: SSLServerSocketImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 13
Source File: SSLServerSocketImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies SSLParameters to newly accepted connections.
 */
@Override
synchronized public void setSSLParameters(SSLParameters params) {
    super.setSSLParameters(params);

    // the super implementation does not handle the following parameters
    identificationProtocol = params.getEndpointIdentificationAlgorithm();
    algorithmConstraints = params.getAlgorithmConstraints();
    preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        sniMatchers = params.getSNIMatchers();
    }
}
 
Example 14
Source File: SSLConfiguration.java    From openjsse with GNU General Public License v2.0 4 votes vote down vote up
void setSSLParameters(SSLParameters params) {
    AlgorithmConstraints ac = params.getAlgorithmConstraints();
    if (ac != null) {
        this.userSpecifiedAlgorithmConstraints = ac;
    }   // otherwise, use the default value

    String[] sa = params.getCipherSuites();
    if (sa != null) {
        this.enabledCipherSuites = CipherSuite.validValuesOf(sa);
    }   // otherwise, use the default values

    sa = params.getProtocols();
    if (sa != null) {
        this.enabledProtocols = ProtocolVersion.namesOf(sa);

        this.maximumProtocolVersion = ProtocolVersion.NONE;
        for (ProtocolVersion pv : enabledProtocols) {
            if (pv.compareTo(maximumProtocolVersion) > 0) {
                this.maximumProtocolVersion = pv;
            }
        }
    }   // otherwise, use the default values

    if (params.getNeedClientAuth()) {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_REQUIRED;
    } else if (params.getWantClientAuth()) {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_REQUESTED;
    } else {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_NONE;
    }

    String s = params.getEndpointIdentificationAlgorithm();
    if (s != null) {
        this.identificationProtocol = s;
    }   // otherwise, use the default value

    List<SNIServerName> sniNames = params.getServerNames();
    if (sniNames != null) {
        this.noSniExtension = sniNames.isEmpty();
        this.serverNames = sniNames;
    }   // null if none has been set

    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        this.noSniMatcher = matchers.isEmpty();
        this.sniMatchers = matchers;
    }   // null if none has been set

    if (params instanceof org.openjsse.javax.net.ssl.SSLParameters) {
        
        sa = ((org.openjsse.javax.net.ssl.SSLParameters)params).getApplicationProtocols();
        if (sa != null) {
            this.applicationProtocols = sa;
        }   // otherwise, use the default values

        this.enableRetransmissions = ((org.openjsse.javax.net.ssl.SSLParameters)params).getEnableRetransmissions();
        this.maximumPacketSize = ((org.openjsse.javax.net.ssl.SSLParameters)params).getMaximumPacketSize();
    }
    this.preferLocalCipherSuites = params.getUseCipherSuitesOrder();
}
 
Example 15
Source File: ReferenceCountedOpenSslEngine.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@Override
public final synchronized void setSSLParameters(SSLParameters sslParameters) {
    int version = PlatformDependent.javaVersion();
    if (version >= 7) {
        if (sslParameters.getAlgorithmConstraints() != null) {
            throw new IllegalArgumentException("AlgorithmConstraints are not supported.");
        }

        if (version >= 8) {
            if (!isDestroyed()) {
                if (clientMode) {
                    final List<String> sniHostNames = Java8SslUtils.getSniHostNames(sslParameters);
                    for (String name: sniHostNames) {
                        SSL.setTlsExtHostName(ssl, name);
                    }
                    this.sniHostNames = sniHostNames;
                }
                if (Java8SslUtils.getUseCipherSuitesOrder(sslParameters)) {
                    SSL.setOptions(ssl, SSL.SSL_OP_CIPHER_SERVER_PREFERENCE);
                } else {
                    SSL.clearOptions(ssl, SSL.SSL_OP_CIPHER_SERVER_PREFERENCE);
                }
            }
            matchers = sslParameters.getSNIMatchers();
        }

        final String endPointIdentificationAlgorithm = sslParameters.getEndpointIdentificationAlgorithm();
        final boolean endPointVerificationEnabled = endPointIdentificationAlgorithm != null &&
                !endPointIdentificationAlgorithm.isEmpty();
        SSL.setHostNameValidation(ssl, DEFAULT_HOSTNAME_VALIDATION_FLAGS,
                endPointVerificationEnabled ? getPeerHost() : null);
        // If the user asks for hostname verification we must ensure we verify the peer.
        // If the user disables hostname verification we leave it up to the user to change the mode manually.
        if (clientMode && endPointVerificationEnabled) {
            SSL.setVerify(ssl, SSL.SSL_CVERIFY_REQUIRED, -1);
        }

        this.endPointIdentificationAlgorithm = endPointIdentificationAlgorithm;
        algorithmConstraints = sslParameters.getAlgorithmConstraints();
    }
    super.setSSLParameters(sslParameters);
}
 
Example 16
Source File: SSLConfiguration.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
void setSSLParameters(SSLParameters params) {
    AlgorithmConstraints ac = params.getAlgorithmConstraints();
    if (ac != null) {
        this.algorithmConstraints = ac;
    }   // otherwise, use the default value

    String[] sa = params.getCipherSuites();
    if (sa != null) {
        this.enabledCipherSuites = CipherSuite.validValuesOf(sa);
    }   // otherwise, use the default values

    sa = params.getProtocols();
    if (sa != null) {
        this.enabledProtocols = ProtocolVersion.namesOf(sa);

        this.maximumProtocolVersion = ProtocolVersion.NONE;
        for (ProtocolVersion pv : enabledProtocols) {
            if (pv.compareTo(maximumProtocolVersion) > 0) {
                this.maximumProtocolVersion = pv;
            }
        }
    }   // otherwise, use the default values

    if (params.getNeedClientAuth()) {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_REQUIRED;
    } else if (params.getWantClientAuth()) {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_REQUESTED;
    } else {
        this.clientAuthType = ClientAuthType.CLIENT_AUTH_NONE;
    }

    String s = params.getEndpointIdentificationAlgorithm();
    if (s != null) {
        this.identificationProtocol = s;
    }   // otherwise, use the default value

    List<SNIServerName> sniNames = params.getServerNames();
    if (sniNames != null) {
        this.noSniExtension = sniNames.isEmpty();
        this.serverNames = sniNames;
    }   // null if none has been set

    Collection<SNIMatcher> matchers = params.getSNIMatchers();
    if (matchers != null) {
        this.noSniMatcher = matchers.isEmpty();
        this.sniMatchers = matchers;
    }   // null if none has been set

    sa = params.getApplicationProtocols();
    if (sa != null) {
        this.applicationProtocols = sa;
    }   // otherwise, use the default values

    this.preferLocalCipherSuites = params.getUseCipherSuitesOrder();
    this.enableRetransmissions = params.getEnableRetransmissions();
    this.maximumPacketSize = params.getMaximumPacketSize();
}