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 * https://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 java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.Collections;
21 import java.util.List;
22
23 /**
24 * Provides utilities related to security requirements specific to HTTP/2.
25 */
26 public final class Http2SecurityUtil {
27 /**
28 * The following list is derived from <a
29 * href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html">SunJSSE Supported
30 * Ciphers</a> and <a
31 * href="https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility">Mozilla Modern Cipher
32 * Suites</a> in accordance with the <a
33 * href="https://tools.ietf.org/html/rfc7540#section-9.2.2">HTTP/2 Specification</a>.
34 *
35 * According to the <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html">
36 * JSSE documentation</a> "the names mentioned in the TLS RFCs prefixed with TLS_ are functionally equivalent
37 * to the JSSE cipher suites prefixed with SSL_".
38 * Both variants are used to support JVMs supporting the one or the other.
39 */
40 public static final List<String> CIPHERS;
41
42 /**
43 * <a href="https://wiki.mozilla.org/Security/Server_Side_TLS#Intermediate_compatibility_.28recommended.29"
44 * >Mozilla Modern Cipher Suites Intermediate compatibility</a> minus the following cipher suites that are black
45 * listed by the <a href="https://tools.ietf.org/html/rfc7540#appendix-A">HTTP/2 RFC</a>.
46 */
47 private static final List<String> CIPHERS_JAVA_MOZILLA_MODERN_SECURITY = Collections.unmodifiableList(Arrays
48 .asList(
49 /* openssl = ECDHE-ECDSA-AES128-GCM-SHA256 */
50 "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
51
52 /* REQUIRED BY HTTP/2 SPEC */
53 /* openssl = ECDHE-RSA-AES128-GCM-SHA256 */
54 "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
55 /* REQUIRED BY HTTP/2 SPEC */
56
57 /* openssl = ECDHE-ECDSA-AES256-GCM-SHA384 */
58 "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
59 /* openssl = ECDHE-RSA-AES256-GCM-SHA384 */
60 "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
61 /* openssl = ECDHE-ECDSA-CHACHA20-POLY1305 */
62 "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256",
63 /* openssl = ECDHE-RSA-CHACHA20-POLY1305 */
64 "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256",
65
66 /* TLS 1.3 ciphers */
67 "TLS_AES_128_GCM_SHA256",
68 "TLS_AES_256_GCM_SHA384",
69 "TLS_CHACHA20_POLY1305_SHA256"
70 ));
71
72 static {
73 CIPHERS = Collections.unmodifiableList(new ArrayList<String>(CIPHERS_JAVA_MOZILLA_MODERN_SECURITY));
74 }
75
76 private Http2SecurityUtil() { }
77 }