1 /* 2 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import javax.net.ssl.*; 25 import java.security.*; 26 import java.net.*; 27 import java.security.cert.*; 28 29 class MyX509ExtendedKeyManager extends X509ExtendedKeyManager { 30 31 X509ExtendedKeyManager akm; 32 MyX509ExtendedKeyManager(X509ExtendedKeyManager akm)33 MyX509ExtendedKeyManager(X509ExtendedKeyManager akm) { 34 this.akm = akm; 35 } 36 getClientAliases(String keyType, Principal[] issuers)37 public String[] getClientAliases(String keyType, Principal[] issuers) { 38 System.out.println("Calling from X509ExtendedKeyManager"); 39 return akm.getClientAliases(keyType, issuers); 40 } 41 chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket)42 public String chooseClientAlias(String[] keyType, Principal[] issuers, 43 Socket socket) { 44 System.out.println("Calling from X509ExtendedKeyManager"); 45 return akm.chooseClientAlias(keyType, issuers, socket); 46 } 47 getServerAliases(String keyType, Principal[] issuers)48 public String[] getServerAliases(String keyType, Principal[] issuers) { 49 System.out.println("Calling from X509ExtendedKeyManager"); 50 return akm.getServerAliases(keyType, issuers); 51 } 52 chooseServerAlias(String keyType, Principal[] issuers, Socket socket)53 public String chooseServerAlias(String keyType, Principal[] issuers, 54 Socket socket) { 55 System.out.println("Calling from X509ExtendedKeyManager"); 56 return akm.chooseServerAlias(keyType, issuers, socket); 57 } 58 getCertificateChain(String alias)59 public X509Certificate[] getCertificateChain(String alias) { 60 System.out.println("Calling from X509ExtendedKeyManager"); 61 return akm.getCertificateChain(alias); 62 } 63 getPrivateKey(String alias)64 public PrivateKey getPrivateKey(String alias) { 65 System.out.println("Calling from X509ExtendedKeyManager"); 66 return akm.getPrivateKey(alias); 67 } 68 chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine)69 public String chooseEngineClientAlias(String[] keyType, 70 Principal[] issuers, SSLEngine engine) { 71 System.out.println("Calling from X509ExtendedKeyManager"); 72 return akm.chooseEngineClientAlias(keyType, issuers, engine); 73 } 74 chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine)75 public String chooseEngineServerAlias(String keyType, 76 Principal[] issuers, SSLEngine engine) { 77 System.out.println("Calling from X509ExtendedKeyManager"); 78 return akm.chooseEngineServerAlias(keyType, issuers, engine); 79 } 80 } 81