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.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package javax.net.ssl;
27 
28 import java.security.Principal;
29 
30 /**
31  * Abstract class that provides for extension of the X509KeyManager
32  * interface.
33  * <P>
34  * Methods in this class should be overriden to provide actual
35  * implementations.
36  *
37  * @since 1.5
38  * @author Brad R. Wetmore
39  */
40 public abstract class X509ExtendedKeyManager implements X509KeyManager {
41 
42     /**
43      * Constructor used by subclasses only.
44      */
X509ExtendedKeyManager()45     protected X509ExtendedKeyManager() {
46     }
47 
48     /**
49      * Choose an alias to authenticate the client side of an
50      * <code>SSLEngine</code> connection given the public key type
51      * and the list of certificate issuer authorities recognized by
52      * the peer (if any).
53      * <P>
54      * The default implementation returns null.
55      *
56      * @param keyType the key algorithm type name(s), ordered
57      *          with the most-preferred key type first.
58      * @param issuers the list of acceptable CA issuer subject names
59      *          or null if it does not matter which issuers are used.
60      * @param engine the <code>SSLEngine</code> to be used for this
61      *          connection.  This parameter can be null, which indicates
62      *          that implementations of this interface are free to
63      *          select an alias applicable to any engine.
64      * @return the alias name for the desired key, or null if there
65      *          are no matches.
66      */
chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine)67     public String chooseEngineClientAlias(String[] keyType,
68             Principal[] issuers, SSLEngine engine) {
69         return null;
70     }
71 
72     /**
73      * Choose an alias to authenticate the server side of an
74      * <code>SSLEngine</code> connection given the public key type
75      * and the list of certificate issuer authorities recognized by
76      * the peer (if any).
77      * <P>
78      * The default implementation returns null.
79      *
80      * @param keyType the key algorithm type name.
81      * @param issuers the list of acceptable CA issuer subject names
82      *          or null if it does not matter which issuers are used.
83      * @param engine the <code>SSLEngine</code> to be used for this
84      *          connection.  This parameter can be null, which indicates
85      *          that implementations of this interface are free to
86      *          select an alias applicable to any engine.
87      * @return the alias name for the desired key, or null if there
88      *          are no matches.
89      */
chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine)90     public String chooseEngineServerAlias(String keyType,
91             Principal[] issuers, SSLEngine engine) {
92         return null;
93     }
94 
95 }
96