3909N/A * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 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 * 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, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * List of Providers. Used to represent the provider preferences. 0N/A * The system starts out with a ProviderList that only has the classNames 0N/A * of the Providers. Providers are loaded on demand only when needed. 0N/A * For compatibility reasons, Providers that could not be loaded are ignored 0N/A * and internally presented as the instance EMPTY_PROVIDER. However, those 0N/A * objects cannot be presented to applications. Call the convert() method 0N/A * to force all Providers to be loaded and to obtain a ProviderList with 0N/A * invalid entries removed. All this is handled by the Security class. 0N/A * Note that all indices used by this class are 0-based per general Java 0N/A * convention. These must be converted to the 1-based indices used by the 0N/A * Security class externally when needed. 0N/A * Instances of this class are immutable. This eliminates the need for 0N/A * cloning and synchronization in consumers. The add() and remove() style 0N/A * methods are static in order to avoid confusion about the immutability. 0N/A * @author Andreas Sterbenz 0N/A // constant for an ProviderList with no elements 0N/A // dummy provider object to use during initialization 0N/A // used to avoid explicit null checks in various places 0N/A new Provider(
"##Empty##",
1.0d,
"initialization in progress") {
0N/A // override getService() to return null slightly faster 0N/A // construct a ProviderList from the security properties 0N/A // (static provider configuration in the java.security file) 0N/A // doPrivileged() because of Security.getProperty() 0N/A // make sure provider exists 0N/A // copy all except matching to new list 0N/A // Create a new ProviderList from the specified Providers. 0N/A // This method is for use by SunJSSE. 0N/A // configuration of the providers 0N/A // flag indicating whether all configs have been loaded successfully 0N/A // List returned by providers() 0N/A * Create a new ProviderList from an array of configs 0N/A * Return a new ProviderList parsed from the java.security Properties. 0N/A for (
int i =
1;
true; i++) {
0N/A "security.provider." + i);
0N/A // Get rid of duplicate providers. 0N/A * Construct a special ProviderList for JAR verification. It consists 0N/A * of the providers specified via jarClassNames, which must be on the 0N/A * bootclasspath and cannot be in signed JAR files. This is to avoid 0N/A * possible recursion and deadlock during verification. 0N/A // if the equivalent object is present in this provider list, 0N/A // use the old object rather than the new object. 0N/A // this ensures that when the provider is loaded in the 0N/A // new thread local list, it will also become available 0N/A // in this provider list 0N/A * Return the Provider at the specified index. Returns EMPTY_PROVIDER 0N/A * if the provider could not be loaded at this time. 0N/A * Return an unmodifiable List of all Providers in this List. The 0N/A * individual Providers are loaded on demand. Elements that could not 0N/A * be initialized are replaced with EMPTY_PROVIDER. 0N/A // return the Provider with the specified name or null 0N/A * Return the index at which the provider with the specified name is 0N/A * installed or -1 if it is not present in this ProviderList. 0N/A // attempt to load all Providers not already loaded 0N/A * Try to load all Providers and return the ProviderList. If one or 0N/A * more Providers could not be loaded, a new ProviderList with those 0N/A * entries removed is returned. Otherwise, the method returns this. 0N/A // return the providers as an array 0N/A // return a String representation of this ProviderList 0N/A * Return a Service describing an implementation of the specified 0N/A * algorithm from the Provider with the highest precedence that 0N/A * supports that algorithm. Return null if no Provider supports this 0N/A * Return a List containing all the Services describing implementations 0N/A * of the specified algorithms in precedence order. If no implementation 0N/A * exists, this method returns an empty List. 0N/A * The elements of this list are determined lazily on demand. 0N/A * The List returned is NOT thread safe. 0N/A * This method exists for compatibility with JCE only. It will be removed 0N/A * once JCE has been changed to use the replacement method. 0N/A * @deprecated use getServices(List<ServiceId>) instead 0N/A * Inner class for a List of Services. Custom List implementation in 0N/A * order to delay Provider initialization and lookup. 0N/A // type and algorithm for simple lookup 0N/A // list of ids for parallel lookup 0N/A // if ids is non-null, type and algorithm are null 0N/A // first service we have found 0N/A // it is stored in a separate variable so that we can avoid 0N/A // allocating the services list if we do not need the second service. 0N/A // this is the case if we don't failover (failovers are typically rare) 0N/A // list of the services we have found so far 0N/A // index into config[] of the next provider we need to query 0N/A // check all algorithms in this provider before moving on 0N/A // override isEmpty() and iterator() to not call size() 0N/A // this avoids loading + checking all Providers