1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package javax.net.ssl; 19 20 import java.security.InvalidAlgorithmParameterException; 21 import java.security.KeyStore; 22 import java.security.KeyStoreException; 23 import java.security.NoSuchAlgorithmException; 24 import java.security.UnrecoverableKeyException; 25 26 /** 27 * The <i>Service Provider Interface</i> (SPI) for the 28 * {@code KeyManagerFactory} class. 29 */ 30 public abstract class KeyManagerFactorySpi { 31 32 /** 33 * Creates a new {@code KeyManagerFactorySpi} instance. 34 */ 35 public KeyManagerFactorySpi() { 36 super(); 37 } 38 39 /** 40 * Initializes this instance with the specified key store and password. 41 * 42 * @param ks 43 * the key store or {@code null} to use the default key store. 44 * @param password 45 * the key store password. 46 * @throws KeyStoreException 47 * if initializing this instance fails. 48 * @throws NoSuchAlgorithmException 49 * if a required algorithm is not available. 50 * @throws UnrecoverableKeyException 51 * if a key cannot be recovered. 52 */ 53 protected abstract void engineInit(KeyStore ks, char[] password) throws KeyStoreException, 54 NoSuchAlgorithmException, UnrecoverableKeyException; 55 56 /** 57 * Initializes this instance with the specified factory parameters. 58 * 59 * @param spec 60 * the factory parameters. 61 * @throws InvalidAlgorithmParameterException 62 * if an error occurs. 63 */ 64 protected abstract void engineInit(ManagerFactoryParameters spec) 65 throws InvalidAlgorithmParameterException; 66 67 /** 68 * Returns a list of key managers, one instance for each type of key in the 69 * key store. 70 * 71 * @return a list of key managers. 72 */ 73 protected abstract KeyManager[] engineGetKeyManagers(); 74 } 75