Path: blob/master/src/java.base/share/classes/javax/net/ssl/TrustManagerFactorySpi.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>TrustManagerFactory</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 trust manager factory.36*37* @since 1.438* @see TrustManagerFactory39* @see TrustManager40*/41public abstract class TrustManagerFactorySpi {42/**43* Constructor for subclasses to call.44*/45public TrustManagerFactorySpi() {}4647/**48* Initializes this factory with a source of certificate49* authorities and related trust material.50*51* @param ks the key store or null52* @throws KeyStoreException if this operation fails53* @see TrustManagerFactory#init(KeyStore)54*/55protected abstract void engineInit(KeyStore ks) throws KeyStoreException;5657/**58* Initializes this factory with a source of provider-specific59* key material.60* <P>61* In some cases, initialization parameters other than a keystore62* may be needed by a provider. Users of that63* particular provider are expected to pass an implementation of64* the appropriate <CODE>ManagerFactoryParameters</CODE> as65* defined by the provider. The provider can then call the66* specified methods in the <CODE>ManagerFactoryParameters</CODE>67* implementation to obtain the needed information.68*69* @param spec an implementation of a provider-specific parameter70* specification71* @throws InvalidAlgorithmParameterException if there is problem72* with the parameters73* @see TrustManagerFactory#init(ManagerFactoryParameters spec)74*/75protected abstract void engineInit(ManagerFactoryParameters spec)76throws InvalidAlgorithmParameterException;7778/**79* Returns one trust manager for each type of trust material.80*81* @throws IllegalStateException if the factory is not initialized.82*83* @return the trust managers84*/85protected abstract TrustManager[] engineGetTrustManagers();86}878889