查看本类的 API文档回源码主页即时通讯网 - 即时通讯开发者社区!
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  
17  package io.netty.handler.ssl.util;
18  
19  import static io.netty.util.internal.ObjectUtil.checkNotNull;
20  
21  import io.netty.util.internal.SuppressJava6Requirement;
22  import java.net.Socket;
23  import java.security.Principal;
24  import java.security.PrivateKey;
25  import java.security.cert.X509Certificate;
26  import javax.net.ssl.SSLEngine;
27  import javax.net.ssl.X509ExtendedKeyManager;
28  import javax.net.ssl.X509KeyManager;
29  
30  @SuppressJava6Requirement(reason = "Usage guarded by java version check")
31  final class X509KeyManagerWrapper extends X509ExtendedKeyManager {
32  
33      private final X509KeyManager delegate;
34  
35      X509KeyManagerWrapper(X509KeyManager delegate) {
36          this.delegate = checkNotNull(delegate, "delegate");
37      }
38  
39      @Override
40      public String[] getClientAliases(String var1, Principal[] var2) {
41          return delegate.getClientAliases(var1, var2);
42      }
43  
44      @Override
45      public String chooseClientAlias(String[] var1, Principal[] var2, Socket var3) {
46          return delegate.chooseClientAlias(var1, var2, var3);
47      }
48  
49      @Override
50      public String[] getServerAliases(String var1, Principal[] var2) {
51          return delegate.getServerAliases(var1, var2);
52      }
53  
54      @Override
55      public String chooseServerAlias(String var1, Principal[] var2, Socket var3) {
56          return delegate.chooseServerAlias(var1, var2, var3);
57      }
58  
59      @Override
60      public X509Certificate[] getCertificateChain(String var1) {
61          return delegate.getCertificateChain(var1);
62      }
63  
64      @Override
65      public PrivateKey getPrivateKey(String var1) {
66          return delegate.getPrivateKey(var1);
67      }
68  
69      @Override
70      public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) {
71          return delegate.chooseClientAlias(keyType, issuers, null);
72      }
73  
74      @Override
75      public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
76          return delegate.chooseServerAlias(keyType, issuers, null);
77      }
78  }