Java Code Examples for org.apache.tomcat.jni.SSL#SSL_OP_NO_SSLv2

The following examples show how to use org.apache.tomcat.jni.SSL#SSL_OP_NO_SSLv2 . 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: OpenSSLEngine.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public synchronized String[] getEnabledProtocols() {
    if (destroyed) {
        return new String[0];
    }
    List<String> enabled = new ArrayList<>();
    // Seems like there is no way to explicitly disable SSLv2Hello in OpenSSL so it is always enabled
    enabled.add(Constants.SSL_PROTO_SSLv2Hello);
    int opts = SSL.getOptions(ssl);
    if ((opts & SSL.SSL_OP_NO_TLSv1) == 0) {
        enabled.add(Constants.SSL_PROTO_TLSv1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_1) == 0) {
        enabled.add(Constants.SSL_PROTO_TLSv1_1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_2) == 0) {
        enabled.add(Constants.SSL_PROTO_TLSv1_2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv2) == 0) {
        enabled.add(Constants.SSL_PROTO_SSLv2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv3) == 0) {
        enabled.add(Constants.SSL_PROTO_SSLv3);
    }
    int size = enabled.size();
    if (size == 0) {
        return new String[0];
    } else {
        return enabled.toArray(new String[size]);
    }
}
 
Example 2
Source File: OpenSslEngine.java    From netty4.0.27Learn with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getEnabledProtocols() {
    List<String> enabled = new ArrayList<String>();
    // Seems like there is no way to explict disable SSLv2Hello in openssl so it is always enabled
    enabled.add(PROTOCOL_SSL_V2_HELLO);
    int opts = SSL.getOptions(ssl);
    if ((opts & SSL.SSL_OP_NO_TLSv1) == 0) {
        enabled.add(PROTOCOL_TLS_V1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_1) == 0) {
        enabled.add(PROTOCOL_TLS_V1_1);
    }
    if ((opts & SSL.SSL_OP_NO_TLSv1_2) == 0) {
        enabled.add(PROTOCOL_TLS_V1_2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv2) == 0) {
        enabled.add(PROTOCOL_SSL_V2);
    }
    if ((opts & SSL.SSL_OP_NO_SSLv3) == 0) {
        enabled.add(PROTOCOL_SSL_V3);
    }
    int size = enabled.size();
    if (size == 0) {
        return EmptyArrays.EMPTY_STRINGS;
    } else {
        return enabled.toArray(new String[size]);
    }
}