Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/provider/VerificationProvider.java
38830 views
/*1* Copyright (c) 1996, 2013, 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 sun.security.provider;2627import java.util.*;28import java.security.*;2930import sun.security.action.PutAllAction;3132import sun.security.rsa.SunRsaSignEntries;3334/**35* Provider used for verification of signed JAR files *if* the Sun and36* SunRsaSign main classes have been removed. Otherwise, this provider is not37* necessary and registers no algorithms. This functionality only exists to38* support a use case required by a specific customer and is not generally39* supported.40*41* @since 1.742* @author Andreas Sterbenz43*/44public final class VerificationProvider extends Provider {4546private static final long serialVersionUID = 7482667077568930381L;4748private static final boolean ACTIVE;4950static {51boolean b;52try {53Class.forName("sun.security.provider.Sun");54Class.forName("sun.security.rsa.SunRsaSign");55b = false;56} catch (ClassNotFoundException e) {57b = true;58}59ACTIVE = b;60}6162public VerificationProvider() {63super("SunJarVerification", 1.8d, "Jar Verification Provider");64// register all algorithms normally registered by the Sun and SunRsaSign65// providers, but only if they are missing66if (ACTIVE == false) {67return;68}6970// if there is no security manager installed, put directly into71// the provider. Otherwise, create a temporary map and use a72// doPrivileged() call at the end to transfer the contents73if (System.getSecurityManager() == null) {74SunEntries.putEntries(this);75SunRsaSignEntries.putEntries(this);76} else {77// use LinkedHashMap to preserve the order of the PRNGs78Map<Object, Object> map = new LinkedHashMap<>();79SunEntries.putEntries(map);80SunRsaSignEntries.putEntries(map);81AccessController.doPrivileged(new PutAllAction(this, map));82}83}8485}868788