View Javadoc
1   /*
2    * Copyright 2019 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.netty5.handler.ssl.util;
17  
18  import javax.net.ssl.SSLEngine;
19  import javax.net.ssl.X509ExtendedKeyManager;
20  import javax.net.ssl.X509KeyManager;
21  import java.net.Socket;
22  import java.security.Principal;
23  import java.security.PrivateKey;
24  import java.security.cert.X509Certificate;
25  import java.util.Objects;
26  
27  final class X509KeyManagerWrapper extends X509ExtendedKeyManager {
28  
29      private final X509KeyManager delegate;
30  
31      X509KeyManagerWrapper(X509KeyManager delegate) {
32          this.delegate = Objects.requireNonNull(delegate, "delegate");
33      }
34  
35      @Override
36      public String[] getClientAliases(String var1, Principal[] var2) {
37          return delegate.getClientAliases(var1, var2);
38      }
39  
40      @Override
41      public String chooseClientAlias(String[] var1, Principal[] var2, Socket var3) {
42          return delegate.chooseClientAlias(var1, var2, var3);
43      }
44  
45      @Override
46      public String[] getServerAliases(String var1, Principal[] var2) {
47          return delegate.getServerAliases(var1, var2);
48      }
49  
50      @Override
51      public String chooseServerAlias(String var1, Principal[] var2, Socket var3) {
52          return delegate.chooseServerAlias(var1, var2, var3);
53      }
54  
55      @Override
56      public X509Certificate[] getCertificateChain(String var1) {
57          return delegate.getCertificateChain(var1);
58      }
59  
60      @Override
61      public PrivateKey getPrivateKey(String var1) {
62          return delegate.getPrivateKey(var1);
63      }
64  
65      @Override
66      public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) {
67          return delegate.chooseClientAlias(keyType, issuers, null);
68      }
69  
70      @Override
71      public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
72          return delegate.chooseServerAlias(keyType, issuers, null);
73      }
74  }