1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.handler.ssl;
17
18 import io.netty5.util.ReferenceCounted;
19 import io.netty5.util.internal.UnstableApi;
20
21 import java.security.Provider;
22
23
24
25
26 public enum SslProvider {
27
28
29
30 JDK,
31
32
33
34 OPENSSL,
35
36
37
38 @UnstableApi
39 OPENSSL_REFCNT;
40
41
42
43
44
45 @SuppressWarnings("deprecation")
46 public static boolean isAlpnSupported(final SslProvider provider) {
47 switch (provider) {
48 case JDK:
49 return JdkAlpnApplicationProtocolNegotiator.isAlpnSupported();
50 case OPENSSL:
51 case OPENSSL_REFCNT:
52 return OpenSsl.isAlpnSupported();
53 default:
54 throw new Error("Unknown SslProvider: " + provider);
55 }
56 }
57
58
59
60
61
62 public static boolean isTlsv13Supported(final SslProvider sslProvider) {
63 return isTlsv13Supported(sslProvider, null);
64 }
65
66
67
68
69
70 public static boolean isTlsv13Supported(final SslProvider sslProvider, Provider provider) {
71 switch (sslProvider) {
72 case JDK:
73 return SslUtils.isTLSv13SupportedByJDK(provider);
74 case OPENSSL:
75 case OPENSSL_REFCNT:
76 return OpenSsl.isTlsv13Supported();
77 default:
78 throw new Error("Unknown SslProvider: " + sslProvider);
79 }
80 }
81
82
83
84
85
86 static boolean isTlsv13EnabledByDefault(final SslProvider sslProvider, Provider provider) {
87 switch (sslProvider) {
88 case JDK:
89 return SslUtils.isTLSv13EnabledByJDK(provider);
90 case OPENSSL:
91 case OPENSSL_REFCNT:
92 return OpenSsl.isTlsv13Supported();
93 default:
94 throw new Error("Unknown SslProvider: " + sslProvider);
95 }
96 }
97 }