View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.http2;
17  
18  import io.netty.util.internal.UnstableApi;
19  
20  import java.util.ArrayList;
21  import java.util.Arrays;
22  import java.util.Collections;
23  import java.util.List;
24  
25  /**
26   * Provides utilities related to security requirements specific to HTTP/2.
27   */
28  @UnstableApi
29  public final class Http2SecurityUtil {
30      /**
31       * The following list is derived from <a
32       * href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html">SunJSSE Supported
33       * Ciphers</a> and <a
34       * href="https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility">Mozilla Modern Cipher
35       * Suites</a> in accordance with the <a
36       * href="https://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-9.2.2">HTTP/2 Specification</a>.
37       *
38       * According to the <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html">
39       * JSSE documentation</a> "the names mentioned in the TLS RFCs prefixed with TLS_ are functionally equivalent
40       * to the JSSE cipher suites prefixed with SSL_".
41       * Both variants are used to support JVMs supporting the one or the other.
42       */
43      public static final List<String> CIPHERS;
44  
45      /**
46       * <a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility">Mozilla Modern Cipher
47       * Suites</a> minus the following cipher suites that are black listed by the
48       * <a href="https://tools.ietf.org/html/rfc7540#appendix-A">HTTP/2 RFC</a>.
49       */
50      private static final List<String> CIPHERS_JAVA_MOZILLA_MODERN_SECURITY = Collections.unmodifiableList(Arrays
51              .asList(
52              /* openssl = ECDHE-ECDSA-AES256-GCM-SHA384 */
53              "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
54              /* openssl = ECDHE-RSA-AES256-GCM-SHA384 */
55              "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
56              /* openssl = ECDHE-ECDSA-CHACHA20-POLY1305 */
57              "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
58              /* openssl = ECDHE-RSA-CHACHA20-POLY1305 */
59              "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
60              /* openssl = ECDHE-ECDSA-AES128-GCM-SHA256 */
61              "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
62  
63              /* REQUIRED BY HTTP/2 SPEC */
64              /* openssl = ECDHE-RSA-AES128-GCM-SHA256 */
65              "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
66              /* REQUIRED BY HTTP/2 SPEC */
67              ));
68  
69      static {
70          CIPHERS = Collections.unmodifiableList(new ArrayList<String>(CIPHERS_JAVA_MOZILLA_MODERN_SECURITY));
71      }
72  
73      private Http2SecurityUtil() { }
74  }