0N/A/*
1879N/A * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1472N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A */
1879N/A
1879N/Apackage javax.net.ssl;
1879N/A
1879N/Aimport java.security.KeyManagementException;
1879N/Aimport java.security.PrivateKey;
1879N/Aimport java.security.Principal;
1879N/Aimport java.security.cert.X509Certificate;
1879N/Aimport java.net.Socket;
1879N/A
1879N/A/**
1879N/A * Instances of this interface manage which X509 certificate-based
1879N/A * key pairs are used to authenticate the local side of a secure
1879N/A * socket.
1879N/A * <P>
1887N/A * During secure socket negotiations, implentations
1887N/A * call methods in this interface to:
1887N/A * <UL>
1887N/A * <LI> determine the set of aliases that are available for negotiations
1887N/A * based on the criteria presented,
1887N/A * <LI> select the <ITALIC> best alias </ITALIC> based on
1887N/A * the criteria presented, and
1887N/A * <LI> obtain the corresponding key material for given aliases.
1887N/A * </UL>
1887N/A * <P>
0N/A * Note: the X509ExtendedKeyManager should be used in favor of this
0N/A * class.
0N/A *
0N/A * @since 1.4
0N/A */
0N/Apublic interface X509KeyManager extends KeyManager {
0N/A /**
0N/A * Get the matching aliases for authenticating the client side of a secure
0N/A * socket given the public key type and the list of
0N/A * certificate issuer authorities recognized by the peer (if any).
0N/A *
0N/A * @param keyType the key algorithm type name
0N/A * @param issuers the list of acceptable CA issuer subject names,
0N/A * or null if it does not matter which issuers are used.
0N/A * @return an array of the matching alias names, or null if there
0N/A * were no matches.
0N/A */
0N/A public String[] getClientAliases(String keyType, Principal[] issuers);
0N/A
0N/A /**
0N/A * Choose an alias to authenticate the client side of a secure
0N/A * socket given the public key type and the list of
0N/A * certificate issuer authorities recognized by the peer (if any).
0N/A *
0N/A * @param keyType the key algorithm type name(s), ordered
3863N/A * with the most-preferred key type first.
0N/A * @param issuers the list of acceptable CA issuer subject names
0N/A * or null if it does not matter which issuers are used.
0N/A * @param socket the socket to be used for this connection. This
0N/A * parameter can be null, which indicates that
0N/A * implementations are free to select an alias applicable
0N/A * to any socket.
0N/A * @return the alias name for the desired key, or null if there
1887N/A * are no matches.
0N/A */
1887N/A public String chooseClientAlias(String[] keyType, Principal[] issuers,
0N/A Socket socket);
0N/A
0N/A /**
0N/A * Get the matching aliases for authenticating the server side of a secure
1887N/A * socket given the public key type and the list of
0N/A * certificate issuer authorities recognized by the peer (if any).
0N/A *
0N/A * @param keyType the key algorithm type name
0N/A * @param issuers the list of acceptable CA issuer subject names
1887N/A * or null if it does not matter which issuers are used.
0N/A * @return an array of the matching alias names, or null
4615N/A * if there were no matches.
0N/A */
0N/A public String[] getServerAliases(String keyType, Principal[] issuers);
0N/A
0N/A /**
0N/A * Choose an alias to authenticate the server side of a secure
0N/A * socket given the public key type and the list of
0N/A * certificate issuer authorities recognized by the peer (if any).
0N/A *
4615N/A * @param keyType the key algorithm type name.
0N/A * @param issuers the list of acceptable CA issuer subject names
4615N/A * or null if it does not matter which issuers are used.
0N/A * @param socket the socket to be used for this connection. This
0N/A * parameter can be null, which indicates that
1887N/A * implementations are free to select an alias applicable
1887N/A * to any socket.
0N/A * @return the alias name for the desired key, or null if there
0N/A * are no matches.
0N/A */
0N/A public String chooseServerAlias(String keyType, Principal[] issuers,
0N/A Socket socket);
0N/A
0N/A /**
0N/A * Returns the certificate chain associated with the given alias.
0N/A *
0N/A * @param alias the alias name
0N/A * @return the certificate chain (ordered with the user's certificate first
0N/A * and the root certificate authority last), or null
0N/A * if the alias can't be found.
0N/A */
0N/A public X509Certificate[] getCertificateChain(String alias);
0N/A
0N/A /**
0N/A * Returns the key associated with the given alias.
0N/A *
0N/A * @param alias the alias name
0N/A * @return the requested key, or null if the alias can't be found.
0N/A */
0N/A public PrivateKey getPrivateKey(String alias);
0N/A}
0N/A