jdk/test/javax/net/ssl/SSLEngine/MyX509KeyManager.java
changeset 23052 241885315119
parent 5506 202f599c92aa
equal deleted inserted replaced
23051:501d8479f798 23052:241885315119
       
     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.net.*;
       
    26 import java.security.*;
       
    27 import java.security.cert.*;
       
    28 
       
    29 class MyX509KeyManager implements X509KeyManager  {
       
    30 
       
    31     X509KeyManager km;
       
    32 
       
    33     MyX509KeyManager(X509KeyManager km) {
       
    34         this.km = km;
       
    35     }
       
    36 
       
    37     public String[] getClientAliases(String keyType, Principal[] issuers) {
       
    38         System.out.println("Calling from X509KeyManager");
       
    39         return km.getClientAliases(keyType, issuers);
       
    40     }
       
    41 
       
    42     public String chooseClientAlias(String[] keyType, Principal[] issuers,
       
    43             Socket socket) {
       
    44         System.out.println("Calling from X509KeyManager");
       
    45         return km.chooseClientAlias(keyType, issuers, socket);
       
    46     }
       
    47 
       
    48     public String[] getServerAliases(String keyType, Principal[] issuers) {
       
    49         System.out.println("Calling from X509KeyManager");
       
    50         return km.getServerAliases(keyType, issuers);
       
    51     }
       
    52 
       
    53     public String chooseServerAlias(String keyType, Principal[] issuers,
       
    54             Socket socket) {
       
    55         System.out.println("Calling from X509KeyManager");
       
    56         return km.chooseServerAlias(keyType, issuers, socket);
       
    57     }
       
    58 
       
    59     public X509Certificate[] getCertificateChain(String alias) {
       
    60         System.out.println("Calling from X509KeyManager");
       
    61         return km.getCertificateChain(alias);
       
    62     }
       
    63 
       
    64     public PrivateKey getPrivateKey(String alias) {
       
    65         System.out.println("Calling from X509KeyManager");
       
    66         return km.getPrivateKey(alias);
       
    67     }
       
    68 }