Path: blob/master/src/java.base/share/classes/javax/net/ssl/KeyManagerFactorySpi.java
41159 views
/*1* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.net.ssl;2627import java.security.*;2829/**30* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)31* for the <code>KeyManagerFactory</code> class.32*33* <p> All the abstract methods in this class must be implemented by each34* cryptographic service provider who wishes to supply the implementation35* of a particular key manager factory.36*37* @since 1.438* @see KeyManagerFactory39* @see KeyManager40*/41public abstract class KeyManagerFactorySpi {42/**43* Constructor for subclasses to call.44*/45public KeyManagerFactorySpi() {}4647/**48* Initializes this factory with a source of key material.49*50* @param ks the key store or null51* @param password the password for recovering keys52* @throws KeyStoreException if this operation fails53* @throws NoSuchAlgorithmException if the specified algorithm is not54* available from the specified provider.55* @throws UnrecoverableKeyException if the key cannot be recovered56* @see KeyManagerFactory#init(KeyStore, char[])57*/58protected abstract void engineInit(KeyStore ks, char[] password) throws59KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException;6061/**62* Initializes this factory with a source of key material.63* <P>64* In some cases, initialization parameters other than a keystore65* and password may be needed by a provider. Users of that66* particular provider are expected to pass an implementation of67* the appropriate <CODE>ManagerFactoryParameters</CODE> as68* defined by the provider. The provider can then call the69* specified methods in the ManagerFactoryParameters70* implementation to obtain the needed information.71*72* @param spec an implementation of a provider-specific parameter73* specification74* @throws InvalidAlgorithmParameterException if there is problem75* with the parameters76* @see KeyManagerFactory#init(ManagerFactoryParameters spec)77*/78protected abstract void engineInit(ManagerFactoryParameters spec)79throws InvalidAlgorithmParameterException;8081/**82* Returns one key manager for each type of key material.83*84* @return the key managers85* @throws IllegalStateException86* if the KeyManagerFactorySpi is not initialized87*/88protected abstract KeyManager[] engineGetKeyManagers();89}909192